diff --git a/docs/zh-Hans/Entity-Framework-Core.md b/docs/zh-Hans/Entity-Framework-Core.md index 1d1a5d5f9d..e7323a076b 100644 --- a/docs/zh-Hans/Entity-Framework-Core.md +++ b/docs/zh-Hans/Entity-Framework-Core.md @@ -1,16 +1,16 @@ -## Entity Framework Core Integration +## Entity Framework Core 集成 -This document explains how to integrate EF Core as an ORM provider to ABP based applications and how to configure it. +本文档介绍了如何将EF Core作为ORM提供程序集成到基于ABP的应用程序以及如何对其进行配置. -### Installation +### 安装 -`Volo.Abp.EntityFrameworkCore` is the main nuget package for the EF Core integration. Install it to your project (for a layered application, to your data/infrastructure layer): +`Volo.Abp.EntityFrameworkCore` 是EF Core 集成的主要nuget包. 将其安装到你的项目中(在分层应用程序中适用于 数据/基础设施层): -```` +``` Install-Package Volo.Abp.EntityFrameworkCore -```` +``` -Then add `AbpEntityFrameworkCoreModule` module dependency to your [module](Module-Development-Basics.md): +然后添加 `AbpEntityFrameworkCoreModule` 模块依赖项到 [module](Module-Development-Basics.cn.md)(项目中的Mudole类): ````C# using Volo.Abp.EntityFrameworkCore; @@ -26,9 +26,9 @@ namespace MyCompany.MyProject } ```` -### Creating DbContext +### 创建 DbContext -You can create your DbContext as you normally do. It should be derived from `AbpDbContext` as shown below: +你可以平常一样创建DbContext,它需要继承自 `AbpDbContext`. 如下所示: ````C# using Microsoft.EntityFrameworkCore; @@ -48,9 +48,9 @@ namespace MyCompany.MyProject } ```` -### Registering DbContext To Dependency Injection +### 将DbContext注册到依赖注入 -Use `AddAbpDbContext` method in your module to register your DbContext class for [dependency injection](Dependency-Injection.md) system. +在module中的ConfigureServices方法使用 `AddAbpDbContext` 在[依赖注入](Dependency-Injection.cn.md)系统注册DbContext类. ````C# using Microsoft.Extensions.DependencyInjection; @@ -72,9 +72,9 @@ namespace MyCompany.MyProject } ```` -#### Add Default Repositories +#### 添加默认仓储 -ABP can automatically create repositories (TODO: link) for the entities in your DbContext. Just use `AddDefaultRepositories()` option on registration: +ABP会自动为DbContext中的实体创建仓储 (TODO: link). 需要在注册的时使用`AddDefaultRepositories()`: ````C# services.AddAbpDbContext(options => @@ -83,7 +83,8 @@ services.AddAbpDbContext(options => }); ```` -This will create a repository for each aggreate root entity (classes derived from AggregateRoot) by default. If you want to create repositories for other entities too, then set `includeAllEntities` to `true`: +默认情况下为每个聚合根实体(从聚合体派生的类)创建一个仓储. 如果想要为其他实体也创建仓储 +需要把`includeAllEntities` 设置为 `true`: ````C# services.AddAbpDbContext(options => @@ -92,16 +93,16 @@ services.AddAbpDbContext(options => }); ```` -Then you can inject and use `IRepository` or `IQueryableRepository` in your services. +然后你就可以在服务中注入和使用 `IRepository` 或 `IQueryableRepository`. -#### Add Custom Repositories +#### 添加自定义仓储 -TODO... +TODO ... -#### Set Base DbContext Class or Interface for Default Repositories +#### 为默认仓储设置Base DbContext类或接口 -... +TODO ... -#### Replace Other Repository +#### 替换其他仓储 -... \ No newline at end of file +TODO ... \ No newline at end of file