Skip to content

Commit

Permalink
Fixes for #5468
Browse files Browse the repository at this point in the history
Module should not change the TransactionBehavior. It should be done in the final application.
Also, revised the document.
  • Loading branch information
hikalkan committed Sep 20, 2020
1 parent a00571d commit d5075a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 3 additions & 1 deletion docs/en/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbpUnitOfWorkDefaultOptions>(options =>
Expand Down
6 changes: 2 additions & 4 deletions docs/en/MongoDB.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbpUnitOfWorkDefaultOptions>(options =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.MongoDB;
using Volo.Abp.Uow;

namespace MyCompanyName.MyProjectName.MongoDB
{
Expand All @@ -19,11 +18,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
* options.AddRepository<Question, MongoQuestionRepository>();
*/
});

Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

0 comments on commit d5075a2

Please sign in to comment.