中 | EN
The purpose of MASA.Contrib is based on MASA.BuildingBlocks to provide open, community driven reusable components for building mesh applications. These components will be used by the MASA Stack and MASA Labs projects.
Structure
MASA.Contrib ├── solution items │ ├── nuget.config ├── src │ ├── BasicAbility │ │ ├── MASA.Contrib.BasicAbility.Dcc ConfigurationAPI │ ├── Configuration │ │ ├── MASA.Contrib.Configuration │ ├── Data │ │ ├── MASA.Contrib.Data.UoW.EF Unit of work │ │ └── MASA.Contrib.Data.Contracts.EF Protocol EF version │ ├── DDD │ │ ├── MASA.Contrib.DDD.Domain In-process and cross-process support │ │ └── MASA.Contrib.DDD.Domain.Repository.EF │ ├── Dispatcher │ │ ├── MASA.Contrib.Dispatcher.Events In-process event │ │ ├── MASA.Contrib.Dispatcher.IntegrationEvents.Dapr │ │ └── MASA.Contrib.Dispatcher.IntegrationEvents.EventLogs.EF Cross-process event │ ├── ReadWriteSpliting │ │ └── CQRS │ │ │ └── MASA.Contrib.ReadWriteSpliting.CQRS CQRS │ ├── Service │ │ └── MASA.Contrib.Service.MinimalAPIs Best practices for [MinimalAPI] ├── test │ ├── MASA.Contrib.Dispatcher.Events │ │ ├── MASA.Contrib.Dispatcher.Events.BenchmarkDotnetTest │ │ ├── MASA.Contrib.Dispatcher.Events.CheckMethodsParameter.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.CheckMethodsParameterNotNull.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.CheckMethodsParameterType.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.CheckMethodsType.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.OnlyCancelHandler.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.CheckMethodsType.Tests │ │ ├── MASA.Contrib.Dispatcher.Events.Tests │ ├── MASA.Contrib.Data.UoW.EF.Tests │ ├── MASA.Contrib.Dispatcher.IntegrationEvents.EventLogs.EF.Tests │ ├── MASA.Contrib.DDD.Domain.Tests │ ├── MASA.Contrib.DDD.Domain.Repository.EF.Tests
Feature
1. MinimalAPI
What is MinimalAPI?Usage introduction
Advantage:
- Classify APIs and add them to different Services to make the Service structure clearer and get rid of running account programming
2. EventBus
Advantage:
- Arrangement of Handler
- Implement Saga
- Middleware
- Transaction
Effect:
- Event and Handler decoupling
- Arrangement of Handler
- Implement Saga
- Middleware
- Transaction
3. CQRS
what isCQRS?Usage introduction
4. IntegrationEventBus
Realize cross-process events based on Dapr。Usage introduction
Advantage:Use the same transaction to commit the user-defined context and the log to ensure atomicity and consistency
5. DomainEventBus
Advantage:
- CQRS
- Domain Service
- Support domain events (in-process), integrated domain events (cross-process)
- Support the unified sending of field events after being pushed onto the stack
6. DDD
DDD // todo
7. Contracts.EF
Protocol based on EF implementation,Usage introduction
Advantage:
- Filter deleted information when querying
- Open transaction after query
- Soft delete
Install-Package MASA.Contrib.Data.Contracts.EF
builder.Services.AddEventBus(options => { options.UseUoW<CustomDbContext>(dbOptions => { dbOptions.UseSqlServer("server=localhost;uid=sa;pwd=P@ssw0rd;database=identity"); dbOptions.UseSoftDelete(builder.Services); }); });
When the entity inherits ISoftware and is deleted, change the delete state to the modified state, and cooperate with the custom Remove operation to achieve soft deletion Do not query the data marked as soft deleted when querying When combined with EventBus, the transaction is opened after the first CUD, and the transaction rollback is supported when the entire Handler is abnormal.
8. MASA.Contrib.Configuration
Redefine Configuration, support the management of Local and ConfigurationAPI nodes, combine IOptions and IOptionsMonitor to complete configuration acquisition and configuration update subscription Local Usage introduction 、Dcc Usage introduction
Unit testing rules
To ensure the reliability of the entire source code, the unit test coverage is at least 90%