-
Notifications
You must be signed in to change notification settings - Fork 2
services.mapping.setup
The mapping plug-in provides structure for mapping source to target objects. This is a common occurrence at the public API boundary where internal aggregates and domain entities are mapped to publicly exposed resource models.
The NetFusion.Mapping plug-in contains an implementation to help structure code responsible for mapping objects. Instead of having this mapping code contained within services or helper classes, the goal is to make the mapping code easy to access without having to add additional code distracting from the core business logic.
The implementation does not depend on any open-source mapping libraries and allows the application code to use their mapping library of choice. It should also be noted that the base implementation does not attempt to map the object's state and is only responsible for loading and resolving the mapping strategies responsible for performing the mappings.
The mapping topic assume an example microservice was creating using the NetFusion microservice template. The example microservice can be created by completing the following steps.
If the netfusion-microservice template is not installed execute the following:
dotnet new install NetFusion.Templates
Next, create the example solution:
cd mkdir Examples.Mapping
cd Examples.Mapping
dotnet new netfusion-microservice --port 5010
The generated microservice is configured to use Serilog and SEQ. A SEQ server instance can be executed within Docker by running the following:
cd ./seq
docker-compose up -d
The SEQ log web interface can be viewed here: http://localhost:8051
The mapping implementation is contained within the following NuGet package: NetFusion.Services.Mapping
Add a reference to the NetFusion.Services.Mapping NuGet package to the Infra project by completing the following:
dotnet add ./src/Components/Examples.Mapping.Infra package NetFusion.Services.Mapping
Next, add the following line of code to add the plugin to the composite-container:
// Add Plugins to the Composite-Container:
builder.Services.CompositeContainer(builder.Configuration, new SerilogExtendedLogger())
.AddSettings()
.AddMapping() // <-- Add this line
.AddPlugin<InfraPlugin>()
.AddPlugin<AppPlugin>()
.AddPlugin<DomainPlugin>()
.AddPlugin<WebApiPlugin>()
.Compose();
-
Templates
-
Resources
-
Bootstrapping
-
Modules Details
-
Settings
-
Validation
-
Monitoring
- Setup
- Commands
- Queries
- Domain Events
- Message Logs
- Message Publishers
- Message Enrichers
- Message Filters
-
Azure Service Bus
-
RabbitMQ
-
Redis
-
MongoDB