Skip to content

Commit

Permalink
Update to new version. Add pipeline config!
Browse files Browse the repository at this point in the history
  • Loading branch information
quyvu01 committed Dec 31, 2024
1 parent e87ae55 commit 2940fa8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ Add the OfX to your service configuration to register OfX:
builder.Services.AddOfX(cfg =>
{
cfg.AddAttributesContainNamespaces(typeof(WhereTheAttributeDefined).Assembly);
cfg.AddHandlersFromNamespaceContaining<SomeHandlerAssemblyMarker>(); <- Add this one when you want to self-handle the request as the example at the end of this guide. Otherwise, if you install the package OfX-gRPC, there is no need to add this one anymore!
cfg.AddHandlersFromNamespaceContaining<SomeHandlerAssemblyMarker>(); //<- Add this one when you want to self-handle the request as the example at the end of this guide. Otherwise, if you install the package OfX-gRPC, there is no need to add this one anymore!
cfg.AddReceivedPipelines(c =>
{
c.OfType(typeof(GenericPipeline<>)).OfType<OtherPipeline>();
});
});
```

Expand All @@ -57,9 +61,9 @@ The Attribute should be inherited from `OfXAttribute` will be scanned!
Parameters:
`Assembly`: The assembly containing the (OfX) attributes.

#### RegisterHandlersContainsAssembly
#### AddHandlersFromNamespaceContaining

Registers assemblies that contain handlers responsible for processing queries or commands for data retrieval.
Add assemblies that contain handlers responsible for processing queries or commands for data retrieval.

Handlers are the execution units that resolve attributes applied to models.

Expand All @@ -69,11 +73,23 @@ Parameters:
`Type`: A marker type within the assembly that includes the handler implementations.
Example:
```csharp
cfg.AddHandlersFromNamespaceContaining<SomeHandlerAssemblyMarker>();
cfg.AddReceivedPipelines(c =>
{
c.OfType(typeof(GenericPipeline<>)).OfType<OtherPipeline>();
});
```

Here, `AddHandlersFromNamespaceContaining` is a type within the assembly where your handler logic resides.

#### AddReceivedPipelines
When you want to create some pipelines to handle the request of some attribute.
Parameters:
`Action<ReceivedPipeline>`: add the pipelines.
Example:
```csharp
cfg.AddHandlersFromNamespaceContaining<SomeHandlerAssemblyMarker>();
```

### 2. Integrate the Attribute into Your Model, Entity, or DTO
Apply the attribute to your properties like this:
```csharp
Expand Down
2 changes: 1 addition & 1 deletion src/OfX.EntityFrameworkCore/OfX.EntityFrameworkCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>default</LangVersion>
<Version>3.0.5</Version>
<Version>3.1.0</Version>
<Authors>Quy Vu</Authors>
<PackageId>OfX-EFCore</PackageId>
<Description>OfX extension. Use EntityFramework as Data Querying</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/OfX.Grpc/OfX.Grpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>default</LangVersion>
<Version>3.0.5</Version>
<Version>3.1.0</Version>
<Authors>Quy Vu</Authors>
<PackageId>OfX-gRPC</PackageId>
<Description>OfX extension. Use gRPC as Data transporting</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/OfX/OfX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>default</LangVersion>
<Version>3.0.5</Version>
<Version>3.1.0</Version>
<Authors>Quy Vu</Authors>
<PackageId>OfX</PackageId>
<Description>The high performance and easiest way to play with microservices for .NET</Description>
Expand Down

0 comments on commit 2940fa8

Please sign in to comment.