Update document

pull/5444/head
liangshiwei 5 years ago
parent 3e86d79133
commit 51b8c2658f

@ -275,6 +275,19 @@ 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
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.
If you are using MongoDB server version less then v4.0, you need disabled the unit of work manually:
```csharp
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
```
### Advanced Topics
#### Set Default Repository Classes

@ -278,18 +278,9 @@ Run the `Acme.BookStore.DbMigrator` application to update the database:
![bookstore-dbmigrator-on-solution](images/bookstore-dbmigrator-on-solution.png)
{{if DB == "EF"}}
`.DbMigrator` is a console application that can be run to **migrate the database schema** and **seed the data** on **development** and **production** environments.
{{end}}
{{if DB == "Mongo"}}
While MongoDB **doesn't require** a database schema migration, it is still good to run this application since it **seeds the initial data** on the database. This application can be used on **development** and **production** environments.
{{end}}
## Create the Application Service
The application layer is separated into two projects:

@ -233,6 +233,19 @@ public class BookService
> 重要:如果你想访问MongoDB API,你需要在你的项目中引用`Volo.Abp.MongoDB`.这会破坏封装,但在这种情况下,这就是你想要的.
#### 事务
MongoDB在4.0版本开始支持事务, ABP在3.2版本加入了对MongoDb事务的支持. 如果你升级到3.2版本,需要将[MongoDbSchemaMigrator](https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MongoDbMyProjectNameDbSchemaMigrator.cs)添加到你的 `.MongoDB` 项目中.
如果你在使用4.0版本之前的MongdoDB数据库,你需要手动禁用工作单元:
```csharp
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
```
#### 高级主题
##### 设置默认的仓储类

@ -270,18 +270,8 @@ namespace Acme.BookStore
![bookstore-dbmigrator-on-solution](images/bookstore-dbmigrator-on-solution.png)
{{if DB == "EF"}}
`.DbMigrator` 是一个控制台使用程序,可以在**开发**和**生产**环境**迁移数据库架构**和**初始化种子数据**.
{{end}}
{{if DB == "Mongo"}}
尽管MongoDB**不需要**数据库架构迁移,但仍建议运行该应用程序,因为它可以在数据库上播种初始数据. 可以在**开发**和**生产**环境中使用.
{{end}}
## 创建应用程序
应用程序层由两个分离的项目组成:

Loading…
Cancel
Save