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
Feat: added handler methods to intercept jsonapi entity framework (#116)
* Feat: added handler methods to intercept jsonapi entity framework for custom entity manipulations
* make the dbcontext accessible to subclasses for interception
* @csantero implemented your suggestions
* implemented as void method
Copy file name to clipboardExpand all lines: README.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,42 @@ The classes in the `JSONAPI.EntityFramework` namespace take great advantage of t
71
71
72
72
-[ ] Add some hints about the configuration of JSONAPI.EntityFramework
73
73
74
+
## Manipulate entities before JSONAPI.EntityFramework persists them
75
+
To change your entities before they get persisted you can extend the `EntityFrameworkDocumentMaterializer<T>` class. You need to register your custom DocumentMaterializer in your `JsonApiConfiguration` like that:
> :information_source: HINT: To get the `Principal` you can add the following part into your `Startup.cs` which registers the `Principal` in Autofac and define a constructor Parameter on your `CustomDocumentMaterializer` of type `IPrincipal`.
## Set the context path of JSONAPI.EntityFramework
75
111
76
112
Per default the routes created for the registered models from EntityFramework will appear in root folder. This can conflict with folders of the file system or other routes you may want to serve from the same project.
0 commit comments