From d5075a27128f9200fa0ea1c4f0f72a8199d65fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 20 Sep 2020 19:04:29 +0300 Subject: [PATCH] Fixes for #5468 Module should not change the TransactionBehavior. It should be done in the final application. Also, revised the document. --- docs/en/Getting-Started.md | 4 +++- docs/en/MongoDB.md | 6 ++---- .../MongoDB/MyProjectNameMongoDbModule.cs | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/en/Getting-Started.md b/docs/en/Getting-Started.md index 860650517e..dbfb8a714e 100644 --- a/docs/en/Getting-Started.md +++ b/docs/en/Getting-Started.md @@ -117,7 +117,9 @@ The solution has a layered structure (based on the [Domain Driven Design](Domain {{ if DB == "Mongo" }} -> The [startup template](Startup-templates/Index.md) **disabled** unit of work transaction in the `.MongoDB` project by default. If your MongoDB server supported transaction, you can enable the `transaction` of unit of work manually: +#### MongoDB Transactions + +The [startup template](Startup-templates/Index.md) **disables** transactions in the `.MongoDB` project by default. If your MongoDB server supports transactions, you can enable the it in the *YourProjectMongoDbModule* class: ```csharp Configure(options => diff --git a/docs/en/MongoDB.md b/docs/en/MongoDB.md index 4138f86f88..1328cfc084 100644 --- a/docs/en/MongoDB.md +++ b/docs/en/MongoDB.md @@ -275,11 +275,9 @@ public class BookService > Important: You must reference to the `Volo.Abp.MongoDB` package from the project you want to access to the MongoDB API. This breaks encapsulation, but this is what you want in that case. -#### Transaction +### Transactions -Starting from version 4.0, MongoDB supports transactions. ABP added support for MongoDB transactions in version 3.2. If you upgrade the project to version 3.2. You need add [MongoDbSchemaMigrator](https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MongoDbMyProjectNameDbSchemaMigrator.cs) to your `.MongoDB` project. - -The [startup template](Startup-templates/Index.md) **disabled** unit of work transaction in the `.MongoDB` project by default. If your MongoDB server supported transaction, you can enable the `transaction` of unit of work manually: +MongoDB supports multi-document transactions starting from the version 4.0 and the ABP Framework supports it. However, the [startup template](Startup-templates/Index.md) **disables** transactions by default. If your MongoDB **server** supports transactions, you can enable the it in the *YourProjectMongoDbModule* class: ```csharp Configure(options => diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbModule.cs index 71a6a8df1a..453806b057 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbModule.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; using Volo.Abp.MongoDB; -using Volo.Abp.Uow; namespace MyCompanyName.MyProjectName.MongoDB { @@ -19,11 +18,6 @@ namespace MyCompanyName.MyProjectName.MongoDB * options.AddRepository(); */ }); - - Configure(options => - { - options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; - }); } } }