Update docs.md

pull/3073/head
liangshiwei 6 years ago
parent af35d3e279
commit 10694d96f2

@ -38,7 +38,7 @@ Note that this document covers `Entity Framework Core` provider but you can also
### 2- Running The Empty Application
After you download the project, extract the ZIP file and open `Acme.MyProject.sln`. You will see that the solution consists of `Application`, `Application.Contrawcts`, `DbMigrator`, `Domain`, `Domain.Shared`, `EntityFrameworkCore`, `EntityFrameworkCore.DbMigations`, `HttpApi`, `HttpApi.Client` and `Web` projects. Right click on `Acme.MyProject.Web` project and **Set as StartUp Project**.
After you download the project, extract the ZIP file and open `Acme.MyProject.sln`. You will see that the solution consists of `Application`, `Application.Contracts`, `DbMigrator`, `Domain`, `Domain.Shared`, `EntityFrameworkCore`, `EntityFrameworkCore.DbMigations`, `HttpApi`, `HttpApi.Client` and `Web` projects. Right click on `Acme.MyProject.Web` project and **Set as StartUp Project**.
![Create a new project](../images/docs-module_solution-explorer.png)
@ -62,21 +62,27 @@ To login your website enter `admin` as the username and `1q2w3E*` as the passwor
Docs module packages are hosted on NuGet. There are 4 packages that needs be to installed to your application. Each package has to be installed to the relevant project.
Install [Volo.Docs.Domain](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget package to `Acme.MyProject.Domain` project.
It is recommended to use the ABP CLI to install the module, open the CMD window in the solution file (`.sln`) directory, and run the following command:
`Install-Package Volo.Docs.Domain`
`abp add-module Volo.Docs`
Install [Volo.Docs.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Docs.EntityFrameworkCore/) nuget package to `Acme.MyProject.EntityFrameworkCore` project.
Or you can also manually install nuget package to each project:
`Install-Package Volo.Docs.EntityFrameworkCore`
* Install [Volo.Docs.Domain](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget package to `Acme.MyProject.Domain` project.
Install [Volo.Docs.Application](https://www.nuget.org/packages/Volo.Docs.Application/) nuget package to `Acme.MyProject.Application` project.
`Install-Package Volo.Docs.Domain`
`Install-Package Volo.Docs.Application`
* Install [Volo.Docs.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Docs.EntityFrameworkCore/) nuget package to `Acme.MyProject.EntityFrameworkCore` project.
Install [Volo.Docs.Web](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget package to `Acme.MyProject.Web` project.
`Install-Package Volo.Docs.EntityFrameworkCore`
`Install-Package Volo.Docs.Web`
* Install [Volo.Docs.Application](https://www.nuget.org/packages/Volo.Docs.Application/) nuget package to `Acme.MyProject.Application` project.
`Install-Package Volo.Docs.Application`
* Install [Volo.Docs.Web](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget package to `Acme.MyProject.Web` project.
`Install-Package Volo.Docs.Web`
### 3- Adding Module Dependencies
@ -165,31 +171,43 @@ An ABP module must declare `[DependsOn]` attribute if it has a dependency upon a
If you choose Entity Framework as your database provider, you need to configure the Docs Module. To do this;
- Open `QaDocDbContextModelCreatingExtensions.cs` and add `modelBuilder.ConfigureDocs()` to the `ConfigureMyProject()`.
- Open `MyProjectMigrationsDbContext.cs` and add `builder.ConfigureDocs()` to the `OnModelCreating()`.
```csharp
public static class QaDocDbContextModelCreatingExtensions
public class MyProjectMigrationsDbContext : AbpDbContext<MyProjectMigrationsDbContext>
{
public static void ConfigureMyProject(this ModelBuilder builder)
public MyProjectMigrationsDbContext(DbContextOptions<MyProjectMigrationsDbContext> options)
: base(options)
{
Check.NotNull(builder, nameof(builder));
/* Configure your own tables/entities inside here */
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(QaDocConsts.DbTablePrefix + "YourEntities", QaDocConsts.DbSchema);
/* Include modules to your migration db context */
// //...
//});
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
builder.ConfigureFeatureManagement();
builder.ConfigureTenantManagement();
builder.ConfigureDocs(); //Add this line to configure the Docs Module
builder.ConfigureDocs();
}
/* Configure customizations for entities from the modules included */
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b)
where TUser: class, IUser
builder.Entity<IdentityUser>(b =>
{
//b.Property<string>(nameof(AppUser.MyProperty))...
b.ConfigureCustomUserProperties();
});
/* Configure your own tables/entities inside the ConfigureQaDoc method */
builder.ConfigureMyProject();
}
}
```

@ -62,19 +62,26 @@ ABP框架的[文档](docs.abp.io)也是使用的此模块.
文档模块包托管在Nuget上面. 需要有四个包安装到你的应用程序中. 每个包必须安装到相关的项目.
安装[Volo.Docs.Domain](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget包到 `Acme.MyProject.Domain` 项目.
建议使用ABP CLI安装模块,在解决方案文件 (`.sln`) 目录打开 `CMD` 窗口,运行以下命令:
`Install-Package Volo.Docs.Domain`
`abp add-module Volo.Docs`
安装[Volo.Docs.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Docs.EntityFrameworkCore/) nuget包到 `Acme.MyProject.EntityFrameworkCore` 项目.
或者你也可以手动安装nuget包到每个项目:
`Install-Package Volo.Docs.EntityFrameworkCore`
* 安装[Volo.Docs.Domain](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget包到 `Acme.MyProject.Domain` 项目.
安装[Volo.Docs.Application](https://www.nuget.org/packages/Volo.Docs.Application/) nuget包到 `Acme.MyProject.Application` 项目.
`Install-Package Volo.Docs.Domain`
`Install-Package Volo.Docs.Application`
* 安装[Volo.Docs.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Docs.EntityFrameworkCore/) nuget包到 `Acme.MyProject.EntityFrameworkCore` 项目.
安装[Volo.Docs.Web](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget包到 `Acme.MyProject.Web` 项目.
`Install-Package Volo.Docs.EntityFrameworkCore`
* 安装[Volo.Docs.Application](https://www.nuget.org/packages/Volo.Docs.Application/) nuget包到 `Acme.MyProject.Application` 项目.
`Install-Package Volo.Docs.Application`
* 安装[Volo.Docs.Web](https://www.nuget.org/packages/Volo.Docs.Domain/) nuget包到 `Acme.MyProject.Web` 项目.
`Install-Package Volo.Docs.Web`
### 3- 添加模块依赖
@ -164,31 +171,43 @@ ABP框架的[文档](docs.abp.io)也是使用的此模块.
如果你选择了Entity Framework 做为数据库供应者,你需要配置文档模块. 做以下操作;
* 打开 `QaDocDbContextModelCreatingExtensions.cs` 并且添加 `modelBuilder.ConfigureDocs()``ConfigureMyProject()` 方法中
* 打开 `MyProjectMigrationsDbContext.cs` 并且添加 `builder.ConfigureDocs()``OnModelCreating()` 方法中
```csharp
public static class QaDocDbContextModelCreatingExtensions
public class MyProjectMigrationsDbContext : AbpDbContext<MyProjectMigrationsDbContext>
{
public static void ConfigureMyProject(this ModelBuilder builder)
public MyProjectMigrationsDbContext(DbContextOptions<MyProjectMigrationsDbContext> options)
: base(options)
{
Check.NotNull(builder, nameof(builder));
/* Configure your own tables/entities inside here */
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
//builder.Entity<YourEntity>(b =>
//{
// b.ToTable(QaDocConsts.DbTablePrefix + "YourEntities", QaDocConsts.DbSchema);
/* Include modules to your migration db context */
// //...
//});
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentity();
builder.ConfigureIdentityServer();
builder.ConfigureFeatureManagement();
builder.ConfigureTenantManagement();
builder.ConfigureDocs(); //Add this line to configure the Docs Module
builder.ConfigureDocs();
}
/* Configure customizations for entities from the modules included */
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b)
where TUser: class, IUser
builder.Entity<IdentityUser>(b =>
{
//b.Property<string>(nameof(AppUser.MyProperty))...
b.ConfigureCustomUserProperties();
});
/* Configure your own tables/entities inside the ConfigureQaDoc method */
builder.ConfigureMyProject();
}
}
```

Loading…
Cancel
Save