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
Copy file name to clipboardExpand all lines: docs/usage/resources/hooks.md
+18-9Lines changed: 18 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,12 @@
1
+
@milosloub@wisepotato.
2
+
3
+
New hooks API is pretty much finished. Below is the usage guide, can also be found in the docs. Time for a re-review.
4
+
5
+
Let us focus first on the discussion of the usage / hooks API / backward compatiblity related stuff.
6
+
7
+
As soon as we're totally aligned with respect to this, we can quibble about internals: at this point any changes internally should not affect the interfaces/hooks API, therefore shouldn't be breaking
8
+
9
+
1
10
2
11
# Resource Hooks
3
12
This section covers the usage of **Resource Hooks**, which is a feature of`ResourceDefinition<T>`. See the [ResourceDefinition usage guide](resource-definitions.md) for a general explanation on how to set up a `ResourceDefinition<T>`.
@@ -14,14 +23,14 @@ Understanding the semantics will be helpful in identifying which hooks on `Resou
*[**Synchronizing data across microservices**](#synchronizing-data-across-microservices)
33
+
*[**Hooks for many-to-many join tables**](#hooks-for-many-to-many-join-tables)
25
34
26
35
27
36
# 1. Semantics: pipelines, actions and hooks
@@ -34,7 +43,7 @@ The different execution flows within the RSL that may be intercepted can be iden
34
43
***Get**: reading a resource (triggered by the endpoint `GET /my-resource`).
35
44
***GetSingle**: reading a single resource (triggered by the endpoint `GET /my-resource/1`).
36
45
37
-
See the [ResourcePipeline](www.will-add-link-later.com) enum for a full list of available pipelines.
46
+
See the [ResourcePipeline](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/feat/%23477/src/JsonApiDotNetCore/Hooks/Execution/ResourcePipelineEnum.cs) enum for a full list of available pipelines.
38
47
39
48
## Actions
40
49
Each pipeline is associated with a set of **actions** that work on resources and their relationships. These actions reflect the associated database operations that is performed by JsonApiDotNetCore (in the Repository Layer). Typically, the RSL will execute some service-layer-related code, then invoke the Repository Layer which will perform these actions, after which the execution returns to the RSL.
@@ -88,7 +97,7 @@ As mentioned in the previous section, some actions are shared across hooks. One
88
97
89
98
Any return content can be intercepted and transformed as desired by implementing the `ResourceDefintion<TEntity>.OnReturn` hook which intercepts the `return` action. For this action, there is no distinction between a `Before` and `After` hook, because no code after a `return` statement can be evaluated. Note that the `return` action can work on *main resources as well as nested resources*, see [this example below](#transforming-data-with-onreturn).
90
99
<br><br>
91
-
For an overview of all pipelines, hooks and actions, see the table below, and for more detailed information about the available hooks, see the [IResourceHookContainer<T>](www.will-add-link-later.com) interface.
100
+
For an overview of all pipelines, hooks and actions, see the table below, and for more detailed information about the available hooks, see the [IResourceHookContainer<T>](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/ab1f96d8255532461da47d290c5440b9e7e6a4a5/src/JsonApiDotNetCore/Hooks/IResourceHookContainer.cs) interface.
0 commit comments