File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ JsonApiDotnetCore provides a framework for building [json:api](http://jsonapi.or
1717 - [Defining Models](#defining-models)
1818 - [Specifying Public Attributes](#specifying-public-attributes)
1919 - [Relationships](#relationships)
20+ - [Resource Names](#resource-names)
2021 - [Defining Controllers](#defining-controllers)
2122 - [Non-Integer Type Keys](#non-integer-type-keys)
2223 - [Routing](#routing)
@@ -169,6 +170,23 @@ public class TodoItem : Identifiable<int>
169170}
170171```
171172
173+ #### Resource Names
174+
175+ If a DbContext is specified when adding the services, the context will be used to define the resources and their names.
176+
177+ ``` csharp
178+ public DbSet < MyModel > SomeModels { get ; set ; } // this will be translated into "some-models"
179+ ```
180+
181+ However, you can specify a custom name like so:
182+
183+ ``` csharp
184+ [Resource (" some-models" )]
185+ public DbSet < MyModel > MyModels { get ; set ; } // this will be translated into "some-models"
186+ ```
187+
188+ For further resource customizations, please see the section on [ Defining Custom Data Access Methods] ( #defining-custom-data-access-methods ) .
189+
172190### Defining Controllers
173191
174192You need to create controllers that inherit from ` JsonApiController<TEntity> ` or ` JsonApiController<TEntity, TId> `
You can’t perform that action at this time.
0 commit comments