0
hungvt created
- ABP Framework version: v3.2.0 I used UnitOfWorkTransactionBehavior.Disabled for mongoDb project, then UnitOfWorkTransactionBehavior of mysql as disable. How to disable only Mongo project. Configure<AbpUnitOfWorkDefaultOptions>(options => { options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; }); Thank!
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
3 Answer(s)
-
0
Hi,
There is no good way to disable yet, You can replace the
UnitOfWorkMongoDbContextProviderclass and removeCreateDbContextWithTransactionmethodMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Try
[Dependency(ReplaceServices = true)] public class MyUnitOfWorkMongoDbContextProvider<TMongoDbContext> : UnitOfWorkMongoDbContextProvider<TMongoDbContext> where TMongoDbContext : IAbpMongoDbContext { public MyUnitOfWorkMongoDbContextProvider(IUnitOfWorkManager unitOfWorkManager, IConnectionStringResolver connectionStringResolver) : base(unitOfWorkManager, connectionStringResolver) { } public new TMongoDbContext CreateDbContextWithTransaction( IUnitOfWork unitOfWork, MongoUrl url, MongoClient client, IMongoDatabase database) { var dbContext = unitOfWork.ServiceProvider.GetRequiredService<TMongoDbContext>(); dbContext.ToAbpMongoDbContext().InitializeDatabase(database, null); return dbContext; } }Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)