Skip to content

Commit

Permalink
Pipeline refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Klusek committed Jan 5, 2024
1 parent 0378f37 commit c63d126
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docs/cqrs/pipeline/adding_custom_middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ Custom middlewares can further augment the pipeline by employing the `UseMiddlew
}
```

Then, you can integrate `EmployeeBlockerMiddleware` into the pipeline as follows:
Moreover, CoreLibrary provides extension methods for `HttpContext`, which can be useful when creating middlewares:

* `GetCQRSEndpoint()`: This method allows access to metadata about the endpoint, providing details such as object types, result types, and handler types involved in the request.

* `GetCQRSRequestPayload()`: By using this `HttpContext` extension method, you can retrieve information about the request payload and the execution result, if the request was handled.

After configuration above, you can integrate `EmployeeBlockerMiddleware` into the pipeline as follows:

```csharp
protected override void ConfigureApp(IApplicationBuilder app)
Expand Down
2 changes: 1 addition & 1 deletion docs/cqrs/pipeline/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The LeanCode CoreLibrary utilizes ASP.NET middlewares to create customized pipel

## Configuration

To establish LeanCode CoreLibrary pipelines, the [MapRemoteCqrs(...)] method from `LeanCode.CQRS.AspNetCore` package needs to be invoked after calling the `UseEndpoints(...)` method on the `IApplicationBuilder`. In the following example, [MapRemoteCqrs(...)] is configured to handle:
CQRS objects can only be registered in the ASP.NET request pipeline via endpoint routing. To register use `IEndpointRouteBuilder.MapRemoteCqrs(...)` extension method (this differs from `UseEndpoints(...)`, as within minimal startup, you can directly invoke it). In `MapRemoteCqrs(...)` you can configure the inner cqrs requests pipeline. In the following example, app is configured to handle:

- [Commands] at `/api/command/FullyQualifiedName`
- [Queries] at `/api/query/FullyQualifiedName`
Expand Down
2 changes: 1 addition & 1 deletion docs/domain/aggregate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Project : IAggregateRoot<ProjectId>
}
```

As you can see, the class implements `IAggregateRoot` interface - it marks the class as being the root of an aggregate. Moreover the `Id` field of the class is of type `ProjectId` - it is a special source-generated type present in the CoreLibrary. You can read more about `Id` types [here](../id/index.md). In this case, the Id of the project will look somewhat like `project_45a8f39f-9df0-4a23-b781-2a46de22fac1`.
As you can see, the class implements `IAggregateRoot` interface - it marks the class as being the root of an aggregate. Moreover the `Id` field of the class is of type `ProjectId` - it is a special source-generated type present in the CoreLibrary. You can read more about `Id` types [here](../id/index.md). In this case, the Id of the project will look somewhat like `project_45a8f39f9df04a23b7812a46de22fac1`.
The Project also has a list of `Assignments`. Notice that there are two lists containing assignments of a project - the `Assignments` one is a readonly interface for the `assignments` which contents can be changed by the class. Moreover project has `OwnerId` property which is an Id of employee who created the project. Generally, we try to model the API in such a way that the objects cannot be changed from the outside - an object's state should be modified only by the methods it exposes.

### Employee
Expand Down

0 comments on commit c63d126

Please sign in to comment.