You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Documentation cleanup, corrections, additions etc
* Removed dead code that breaks upgrade to EF Core 5
* Fixed placeholder
* Package updates
* Fix for failing tests in EF Core 5 RC1
Copy file name to clipboardExpand all lines: docs/usage/extensibility/controllers.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ public class ArticlesController : JsonApiController<Article>
16
16
17
17
## Non-Integer Type Keys
18
18
19
-
If your model is using a type other than int for the primary key, you must explicitly declare it in the controller and service generic type definitions.
19
+
If your model is using a type other than `int` for the primary key, you must explicitly declare it in the controller/service/repository definitions.
@@ -34,7 +34,7 @@ public class ArticlesController : JsonApiController<Article, Guid>
34
34
35
35
## Resource Access Control
36
36
37
-
It is often desirable to limit what methods are exposed on your controller. The first way, you can do this is to simply inherit from `BaseJsonApiController` and explicitly declare what methods are available.
37
+
It is often desirable to limit what methods are exposed on your controller. The first way you can do this, is to simply inherit from `BaseJsonApiController` and explicitly declare what methods are available.
38
38
39
39
In this example, if a client attempts to do anything other than GET a resource, an HTTP 404 Not Found response will be returned since no other methods are exposed.
Customization can be done at any of these layers. However, it is recommended that you make your customizations at the service or the repository layer when possible to keep the controllers free of unnecessary logic.
13
+
Customization can be done at any of these layers. However, it is recommended that you make your customizations at the service or the repository layer when possible, to keep the controllers free of unnecessary logic.
14
14
You can use the following as a general rule of thumb for where to put business logic:
15
15
16
16
-`Controller`: simple validation logic that should result in the return of specific HTTP status codes, such as model validation
@@ -19,36 +19,15 @@ You can use the following as a general rule of thumb for where to put business l
19
19
20
20
## Replacing Services
21
21
22
-
**Note:** If you are using auto-discovery, services will be automatically registered for you.
22
+
**Note:** If you are using auto-discovery, resource services and repositories will be automatically registered for you.
23
23
24
-
Replacing services is done on a per-resource basis and can be done through simple DI in your Startup.cs file.
25
-
26
-
In v3.0.0 we introduced an extenion method that you should use to
27
-
register services. This method handles some of the common issues
28
-
users have had with service registration.
24
+
Replacing services and repositories is done on a per-resource basis and can be done through dependency injection in your Startup.cs file.
Copy file name to clipboardExpand all lines: docs/usage/extensibility/repositories.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,20 @@
1
1
# Resource Repositories
2
2
3
-
If you want to use a data access technology other than Entity Framework Core, you can create an implementation of IResourceRepository<TResource, TId>.
4
-
If you only need minor changes you can override the methods defined in EntityFrameworkCoreRepository<TResource, TId>.
3
+
If you want to use a data access technology other than Entity Framework Core, you can create an implementation of `IResourceRepository<TResource, TId>`.
4
+
If you only need minor changes you can override the methods defined in `EntityFrameworkCoreRepository<TResource, TId>`.
5
5
6
6
The repository should then be added to the service collection in Startup.cs.
A sample implementation that performs authorization might look like this.
17
16
18
-
All of the methods in EntityFrameworkCoreRepository will use the GetAll() method to get the DbSet<TResource>, so this is a good method to apply filters such as user or tenant authorization.
17
+
All of the methods in EntityFrameworkCoreRepository will use the `GetAll()` method to get the `DbSet<TResource>`, so this is a good method to apply filters such as user or tenant authorization.
0 commit comments