Update document

pull/8897/head
liangshiwei 4 years ago
parent f39543add6
commit 6bd06f6f67

@ -706,7 +706,19 @@ One advantage of using an interface for a DbContext is then it will be replaceab
### Replace Other DbContextes
Once you properly define and use an interface for DbContext, then any other implementation can replace it using the `ReplaceDbContext` option:
Once you properly define and use an interface for DbContext, then any other implementation can use the following ways to replace it:
**ReplaceDbContextAttribute**
```csharp
[ReplaceDbContext(typeof(IBookStoreDbContext))]
public class OtherDbContext : AbpDbContext<OtherDbContext>, IBookStoreDbContext
{
//...
}
```
**ReplaceDbContext option**
````csharp
context.Services.AddAbpDbContext<OtherDbContext>(options =>

@ -373,7 +373,19 @@ One advantage of using interface for a MongoDbContext is then it becomes replace
#### Replace Other DbContextes
Once you properly define and use an interface for a MongoDbContext , then any other implementation can replace it using the `ReplaceDbContext` option:
Once you properly define and use an interface for a MongoDbContext , then any other implementation can use the following ways to replace it:
**ReplaceDbContextAttribute**
```csharp
[ReplaceDbContext(typeof(IBookStoreMongoDbContext))]
public class OtherMongoDbContext : AbpMongoDbContext, IBookStoreMongoDbContext
{
//...
}
```
**ReplaceDbContext option**
```csharp
context.Services.AddMongoDbContext<OtherMongoDbContext>(options =>

@ -433,7 +433,19 @@ public class BookRepository : EfCoreRepository<IBookStoreDbContext, Book, Guid>,
### 替换其他仓储
正确定义并使用DbContext接口后,任何其他实现都可以使用以下ReplaceDbContext options 替换它:
正确定义并使用DbContext接口后,任何其他实现都可以使用以下方法替换它:
**ReplaceDbContextAttribute**
```csharp
[ReplaceDbContext(typeof(IBookStoreDbContext))]
public class OtherDbContext : AbpDbContext<OtherDbContext>, IBookStoreDbContext
{
//...
}
```
**ReplaceDbContext option**
````csharp
context.Services.AddAbpDbContext<OtherDbContext>(options =>

@ -329,7 +329,19 @@ public class BookRepository
##### 替换其他的DbContexts
一旦你正确定义并为MongoDbContext使用了接口,其他的实现就可以使用`ReplaceDbContext`来替换:
一旦你正确定义并为MongoDbContext使用了接口,任何其他实现都可以使用以下方法替换它:
**ReplaceDbContextAttribute**
```csharp
[ReplaceDbContext(typeof(IBookStoreMongoDbContext))]
public class OtherMongoDbContext : AbpMongoDbContext, IBookStoreMongoDbContext
{
//...
}
```
**ReplaceDbContext option**
```csharp
context.Services.AddMongoDbContext<OtherMongoDbContext>(options =>

Loading…
Cancel
Save