Osharp3 experience: Integration of DbContextScope 1, 3
Osharp3's transaction processing is controlled by skipping the savechangeing method, without DbContextScope expertise
DbContextScope Advantages and Disadvantages of dbcontext management this article does not discuss
Integration Process:
1. In. Data. Entity/Extensions/ServiceCollectionExtensions. cs
Inject 1 DbContextScopeFactory and IAmbientDbContextLocator,
And remove the IUnitOfWork injection,
It means that dbContext is completely handed over to DbContextScope for management.
Ii. Repository transformation <TEntity, TKey>
3. public IDbContextScopeFactory _ dbContextScopeFactory {get; set;} is injected into the application service layer ;}
Iv. Usage
5. Modify DbContextScope and Add DbContext Get (Type _ DbContextType );
The changes are as follows:
Https://github.com/shiningrise/DbContextScope/commit/8d48f584d0c1a159e2688f2dda5135356137d4b0