@@ -248,9 +248,10 @@ services.AddJsonApi<AppDbContext>(
248248#### Disable Convention
249249
250250You can disable the dasherized convention and specify your own template
251- by using the ` DisableRoutingConvention ` Attribute:
251+ by using the ` DisableRoutingConvention ` Attribute.
252252
253253``` csharp
254+ [Route (" [controller]" )]
254255[DisableRoutingConvention ]
255256public class CamelCasedModelsController : JsonApiController <CamelCasedModel >
256257{
@@ -263,6 +264,22 @@ public class CamelCasedModelsController : JsonApiController<CamelCasedModel>
263264}
264265```
265266
267+ It is important to note that your routes * must* still end with the model name in the same format
268+ as the resource name. This is so that we can build accurrate resource links in the json: api document.
269+ For example, if you define a resource as ` MyModels ` the controller route must match:
270+
271+ ``` csharp
272+ // resource definition
273+ builder .AddResource <TodoItem >(" myModels" );
274+
275+ // controller definition
276+ [Route (" api/myModels" )]
277+ [DisableRoutingConvention ]
278+ public class TodoItemsController : JsonApiController <TodoItem >
279+ { // ...
280+ }
281+ ```
282+
266283### Defining Custom Data Access Methods
267284
268285By default, data retrieval is distributed across 3 layers:
@@ -287,7 +304,7 @@ public void ConfigureServices(IServiceCollection services)
287304 services .AddJsonApi (options => {
288305 options .Namespace = " api/v1" ;
289306 options .BuildContextGraph ((builder ) => {
290- builder .AddResource <MyModel >(" my-models" );
307+ builder .AddResource <MyModel >(" my-models" );1
291308 });
292309 }, mvcBuilder );
293310 // ...
0 commit comments