@@ -248,9 +248,10 @@ services.AddJsonApi<AppDbContext>(
248
248
#### Disable Convention
249
249
250
250
You can disable the dasherized convention and specify your own template
251
- by using the ` DisableRoutingConvention ` Attribute:
251
+ by using the ` DisableRoutingConvention ` Attribute.
252
252
253
253
``` csharp
254
+ [Route (" [controller]" )]
254
255
[DisableRoutingConvention ]
255
256
public class CamelCasedModelsController : JsonApiController <CamelCasedModel >
256
257
{
@@ -263,6 +264,22 @@ public class CamelCasedModelsController : JsonApiController<CamelCasedModel>
263
264
}
264
265
```
265
266
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
+
266
283
### Defining Custom Data Access Methods
267
284
268
285
By default, data retrieval is distributed across 3 layers:
@@ -287,7 +304,7 @@ public void ConfigureServices(IServiceCollection services)
287
304
services .AddJsonApi (options => {
288
305
options .Namespace = " api/v1" ;
289
306
options .BuildContextGraph ((builder ) => {
290
- builder .AddResource <MyModel >(" my-models" );
307
+ builder .AddResource <MyModel >(" my-models" );1
291
308
});
292
309
}, mvcBuilder );
293
310
// ...
0 commit comments