@ -0,0 +1,137 @@ |
|||
# ABP CLI |
|||
|
|||
ABP CLI (Command Line Interface) is a command line tool to perform some common operations for ABP based solutions. |
|||
|
|||
## Installation |
|||
|
|||
ABP CLI is a [dotnet global tool](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools). Install it using a command line window: |
|||
|
|||
````bash |
|||
dotnet tool install -g Volo.Abp.Cli |
|||
```` |
|||
|
|||
To update an existing installation: |
|||
|
|||
````bash |
|||
dotnet tool update -g Volo.Abp.Cli |
|||
```` |
|||
|
|||
## Commands |
|||
|
|||
### new |
|||
|
|||
Generates a new solution based on the ABP [startup templates](Startup-Templates/Index.md). |
|||
|
|||
Basic usage: |
|||
|
|||
````bash |
|||
abp new <solution-name> [options] |
|||
```` |
|||
|
|||
Example: |
|||
|
|||
````bash |
|||
abp new Acme.BookStore |
|||
```` |
|||
|
|||
* Acme.BookStore is the solution name here. |
|||
* Common convention is to name a solution is like *YourCompany.YourProject*. However, you can use different naming like *YourProject* (single level namespacing) or *YourCompany.YourProduct.YourModule* (three levels namespacing). |
|||
|
|||
#### Options |
|||
|
|||
* `--template` or `-t`: Specifies the template name. Default template name is `mvc`. Available templates: |
|||
* `mvc` (default): ASP.NET Core [MVC application template](Startup-Templates/Mvc.md). Additional options: |
|||
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers: |
|||
* `ef`: Entity Framework Core. |
|||
* `mongodb`: MongoDB. |
|||
* `--tiered`: Creates a tiered solution where Web and Http API layers are physically separated. If not specified, it creates a layered solution which is less complex and suitable for most scenarios. |
|||
* `mvc-module`: ASP.NET Core [MVC module template](Startup-Templates/Mvc-Module.md). Additional options: |
|||
* `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI). |
|||
* `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. |
|||
|
|||
### add-package |
|||
|
|||
Adds a new ABP package to a project by, |
|||
|
|||
* Adding related nuget package as a dependency to the project. |
|||
* Adding `[DependsOn(...)]` attribute to the module class in the project (see the [module development document](Module-Development-Basics.md)). |
|||
|
|||
> Notice that the added module may require additional configuration which is generally indicated in the documentation of the related package. |
|||
|
|||
Basic usage: |
|||
|
|||
````bash |
|||
abp add-package <package-name> [options] |
|||
```` |
|||
|
|||
Example: |
|||
|
|||
```` |
|||
abp add-package Volo.Abp.MongoDB |
|||
```` |
|||
|
|||
* This example adds the Volo.Abp.MongoDB package to the project. |
|||
|
|||
#### Options |
|||
|
|||
* `--project` or `-p`: Specifies the project (.csproj) file path. If not specified, CLI tries to find a .csproj file in the current directory. |
|||
|
|||
### add-module |
|||
|
|||
Adds a multi-package module to a solution by finding all packages of the module, finding related projects in the solution and adding each package to the corresponding project in the solution. |
|||
|
|||
> A business module generally consists of several packages (because of layering, different database providr options or other reasons). Using `add-module` command dramatically simplifies adding a module to a solution. However, each module may require some additional configurations which is generally indicated in the documentation of the related module. |
|||
|
|||
Basic usage: |
|||
|
|||
````bash |
|||
abp add-module <module-name> [options] |
|||
```` |
|||
|
|||
Example: |
|||
|
|||
```bash |
|||
abp add-module Volo.Blogging |
|||
``` |
|||
|
|||
* This example add the Volo.Blogging module to the solution. |
|||
|
|||
#### Options |
|||
|
|||
* `--solution` or `-s`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory. |
|||
* `--skip-db-migrations`: For EF Core database provider, it automatically adds a new code first migration (`Add-Migration`) and updates the database (`Update-Database`) if necessary. Specify this option to skip this operation. |
|||
|
|||
### update |
|||
|
|||
Updating all ABP related packages can be tedious since there are many packages of the framework and modules. This command automatically updates all ABP related packages in a solution or project to the latest versions. |
|||
|
|||
Usage: |
|||
|
|||
````bash |
|||
abp update [options] |
|||
```` |
|||
|
|||
* If you run in a directory with a .sln file, it updates all ABP related packages of the all projects of the solution to the latest versions. |
|||
* If you run in a directory with a .csproj file, it updates all ABP related packages of the project to the latest versions. |
|||
|
|||
#### Options |
|||
|
|||
* `--include-previews` or `-p`: Includes preview, beta and rc packages while checking the latest versions. |
|||
|
|||
### help |
|||
|
|||
Writes basic usage information of the CLI. |
|||
|
|||
Usage: |
|||
|
|||
````bash |
|||
abp help [command-name] |
|||
```` |
|||
|
|||
Examples: |
|||
|
|||
````bash |
|||
abp help # Shows a general help. |
|||
abp help new # Shows help about the "new" command. |
|||
```` |
|||
|
|||
@ -0,0 +1,3 @@ |
|||
# Data Seeding |
|||
|
|||
TODO |
|||
@ -1,68 +1,32 @@ |
|||
# ABP 文档 |
|||
|
|||
> 翻译来自[cnAbp](https://github.com/cnabp)组织,中文网会持续跟进翻译,目前Abp vNext的英文文档还未完成,大家对整体框架没有深入的理解,翻译难免存在一些问题.敬请见谅.😀 |
|||
> 中文文档翻译来自[cnAbp](https://github.com/cnabp)组织,Abp中文网会持续跟进翻译,目前Abp vNext的英文文档还未完成,大家对整体框架没有深入的理解,翻译难免存在一些问题.敬请见谅.😀 |
|||
|
|||
## 目录 |
|||
ABP是一个**开源应用程序框架**,专注于基于ASP.NET Core的Web应用程序开发,但也支持开发其他类型的应用程序. |
|||
|
|||
* 入门 |
|||
* 从启动模板开始 |
|||
* [ASP.NET Core MVC 模板](Getting-Started-AspNetCore-MVC-Template.md) |
|||
* 从空项目开始 |
|||
* [使用Console Application](Getting-Started-Console-Application.md) |
|||
* [使用 ASP.NET Core Web Application](Getting-Started-AspNetCore-Application.md) |
|||
* 教程 |
|||
* 应用开发 |
|||
* [使用 ASP.NET Core MVC](Tutorials/AspNetCore-Mvc/Part-I.md) |
|||
* 基础知识 |
|||
* [依赖注入](Dependency-Injection.md) |
|||
* AutoFac 集成 |
|||
* [虚拟文件系统](Virtual-File-System.md) |
|||
* [本地化](Localization.md) |
|||
* [异常处理](Exception-Handling.md) |
|||
* 验证 |
|||
* 授权 |
|||
* 缓存 |
|||
* 审计 |
|||
* 设置管理 |
|||
* 对象映射 |
|||
* AutoMapper 集成 |
|||
* 事件 |
|||
* 本地 Event Bus |
|||
* 分布式 Event Bus |
|||
* RabbitMQ 集成 |
|||
* 服务 |
|||
* 对象序列化 |
|||
* JSON序列化 |
|||
* 邮件 |
|||
* GUIDs |
|||
* 线程 |
|||
* 定时 |
|||
* [多租户](Multi-Tenancy.md) |
|||
* 模块开发 |
|||
* [基础](Module-Development-Basics.md) |
|||
* 模块插件 |
|||
* [最佳实践](Best-Practices/Index.md) |
|||
* 领域驱动设计 |
|||
* 领域层 |
|||
* [实体&聚合根](Entities.md) |
|||
* 值对象 |
|||
* [仓储](Repositories.md) |
|||
* 领域服务 |
|||
* 规约 |
|||
* 应用服务层 |
|||
* 应用服务 |
|||
* 数据传输对象(DTO) |
|||
* 工作单元 |
|||
* ASP.NET Core MVC |
|||
* API 版本控制 |
|||
* 用户界面 |
|||
* [客户端包管理](AspNetCore/Client-Side-Package-Management.md) |
|||
* [捆绑&压缩](AspNetCore/Bundling-Minification.md) |
|||
* [Tag Helpers](Tag-Helpers.md) |
|||
* [主题](AspNetCore/Theming.md) |
|||
* 后台服务 |
|||
* [后台作业](Background-Jobs.md) |
|||
* 数据访问 |
|||
* [Entity Framework Core 集成](Entity-Framework-Core.md) |
|||
* [MongoDB 集成](MongoDB.md) |
|||
* 测试 |
|||
浏览左侧导航菜单以深入了解文档. |
|||
|
|||
## 项目状态 |
|||
|
|||
ABP是开源[ASP.NET Boilerplate](https://aspnetboilerplate.com/)框架的**下一代框架**, 它目前处于早期预览阶段,尚未准备好在生产中使用. 文档仍在进行中,远未完成. |
|||
|
|||
对于短期和生产级应用程序, 建议使用[ASP.NET Boilerplate](https://aspnetboilerplate.com/)框架,该框架具有丰富的功能集,成熟,积极维护和最新. |
|||
|
|||
## 入门 |
|||
|
|||
使用ABP开发新项目的最简单方法是使用启动模板: |
|||
|
|||
* [ASP.NET Core MVC 模板](Getting-Started-AspNetCore-MVC-Template.md) |
|||
|
|||
如果您想从头开始(使用空项目),请手动安装ABP框架并使用以下教程: |
|||
|
|||
* [控制台应用程序](Getting-Started-Console-Application.md) |
|||
* [ASP.NET Core Web 应用程序](Getting-Started-AspNetCore-Application.md) |
|||
|
|||
## 源码 |
|||
|
|||
ABP托管在GitHub上, 参见[源代码](https://github.com/abpframework/abp). |
|||
|
|||
## 贡献代码 |
|||
|
|||
ABP是一个社区驱动的开源项目.如果你想成为该项目的一部分,请参阅[贡献指南](Contribution/Index.md). |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
# 启动模板 |
|||
|
|||
虽然你可以从一个空项目开始并手动添加所需的包,但启动模板可以非常轻松,舒适地使用ABP框架启动新的解决方案. |
|||
|
|||
单击下面列表中的名称以查看相关启动模板的文档: |
|||
|
|||
* [**mvc**](Mvc.md): ASP.NET Core MVC应用程序模板. |
|||
* [**mvc-module**](Mvc-Module.md): ASP.NET Core MVC模块/服务模板. |
|||
@ -0,0 +1,6 @@ |
|||
# MVC Module 启动模板 |
|||
|
|||
TODO |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,183 @@ |
|||
# MVC Application Startup Template |
|||
|
|||
## Introduction |
|||
|
|||
This template provides a layered (or tiered, based on the preference) application structure based on the [Domain Driven Design](../Domain-Driven-Design.md) (DDD) practices. |
|||
|
|||
## How to Start With |
|||
|
|||
You can use the [ABP CLI](../CLI.md) to create a new project using this startup template. Alternatively, you can directly create & download from the [Get Started](https://abp.io/get-started) page. CLI approach is used here. |
|||
|
|||
First, install the ABP CLI as described in [its document](../CLI.md). Then use the `abp new` command in an empty folder to create a new solution: |
|||
|
|||
````bash |
|||
abp new Acme.BookStore -t mvc |
|||
```` |
|||
|
|||
* `Acme.BookStore` is the solution name, like *YourCompany.YourProduct*. See the [CLI document](../CLI.md) for different naming styles. |
|||
* This example specified the template name (`-t` or `--template` option). However, `mvc` is the default template and used even if you don't specify it. |
|||
|
|||
### Specify Database Provider |
|||
|
|||
This template supports the following database providers: |
|||
|
|||
- `ef`: Entity Framework Core (default) |
|||
- `mongodb`: MongoDB |
|||
|
|||
Use the `-d` (or `--database-provider`) to specify the database provider: |
|||
|
|||
````bash |
|||
abp new Acme.BookStore -t mvc -d mongodb |
|||
```` |
|||
|
|||
### Create a Tiered Solution |
|||
|
|||
`--tiered` option is used to create a tiered solution where Web and Http API layers are physically separated. If not specified, it creates a layered solution which is less complex and suitable for most scenarios. |
|||
|
|||
````bash |
|||
abp new Acme.BookStore --tiered |
|||
```` |
|||
|
|||
See the "Tiered Structure" section below for the tiered approach. |
|||
|
|||
## Solution Structure |
|||
|
|||
Based on the options you've specified, you will get a slightly different solution structure. |
|||
|
|||
### Default Structure |
|||
|
|||
If you don't specify any option, you will have a solution like shown below: |
|||
|
|||
 |
|||
|
|||
Projects are organized in `src` and `test` folders. `src` folder contains the actual application which is layered based on [DDD](../Domain-Driven-Design.md) principles as mentioned before. |
|||
|
|||
-------------------- |
|||
|
|||
**TODO: Add a graphic to illustrate dependencies between projects.** |
|||
|
|||
------------------ |
|||
|
|||
Each section below will explain the related project. |
|||
|
|||
#### .Domain Project |
|||
|
|||
This is the domain layer of the solution. It mainly contains [entities, aggregate roots](../Entities.md), [domain services](../Domain-Services.md), [value types](../Value-Types.md), [repository interfaces](../Repositories.md) and other domain objects of the solution. |
|||
|
|||
A `Book` entity and a `IBookRepository` interface are good candidates for this project. |
|||
|
|||
* Depends on the `.Domain.Shared` because it uses constants, enums and other objects defined in that project. |
|||
|
|||
#### .Domain.Shared Project |
|||
|
|||
This project contains constants, enums and other objects these are actually a part of the domain layer, but needed to be used by all layers/projects in the solution. |
|||
|
|||
A `BookType` enum and a `BookConts` class (which may have some constant fields for the `Book` entity, like `MaxNameLength`) are good candidates for this project. |
|||
|
|||
This project has no dependency to other projects in the solution. |
|||
|
|||
#### .Application.Contracts Project |
|||
|
|||
This project mainly contains [application service](../Application-Services.md) **interfaces** and [Data Transfer Objects](../Data-Transfer-Objects.md) (DTO) of the application layer. It does exists to separate interface & implementation of the application layer. In this way, the interface project can be shared to the clients as a contract package. |
|||
|
|||
* Depends on the `.Domain.Shared` because it may use constants, enums and other shared objects in the application service interfaces and DTOs. |
|||
|
|||
#### .Application Project |
|||
|
|||
This project contains the [application service](../Application-Services.md) implementations of the interfaces defined in the `.Application.Contracts` project. |
|||
|
|||
* Depends on the `.Application.Contracts` project to be able to implement the interfaces and use the DTOs. |
|||
* Depends on the `.Domain` project to be able to use domain objects (entities, repository interfaces... etc.) to perform the application logic. |
|||
|
|||
#### .EntityFrameworkCore Project. |
|||
|
|||
This is the integration project for the EF Core. It defines the `DbContext` and implements repository interfaces defined in the `.Domain` project. |
|||
|
|||
* Depends on the `.Domain` project to be able to reference to entities and repository interfaces. |
|||
|
|||
> This project is available only if you are using EF Core as the database provider. |
|||
|
|||
#### .EntityFrameworkCore.DbMigrations Project |
|||
|
|||
Contains EF Cor database migrations for the solution. It has a separated `DbContext` to dedicated to manage migrations. |
|||
|
|||
ABP is a modular framework and with an ideal design, each module has its own `DbContext` class. This is where the migration `DbContext` comes into play and unifies all `DbContext` configurations into a single model to maintain a single database schema. |
|||
|
|||
Notice that the migration `DbContext` is only used for database migrations and *not used on runtime*. |
|||
|
|||
* Depends on the `.EntityFrameworkCore` project since it re-uses the configuration defined for the `DbContext` of the application. |
|||
|
|||
> This project is available only if you are using EF Core as the database provider. |
|||
|
|||
#### .DbMigrator Project |
|||
|
|||
This is a console application which simplifies to execute database migrations on development and production environments. When you this application; |
|||
|
|||
* Creates the database if necessary. |
|||
* Applies database migrations. |
|||
* Seeds initial data. |
|||
|
|||
> This project has its own `appsettings.json` file. So, if you want to change the database connection string, remember to change this file. |
|||
|
|||
Especially, seeding initial data is important at this point. ABP has a modular data seed infrastructure. See [its documentation](../Data-Seeding.md) for more about the data seeding. |
|||
|
|||
While creating database & applying migrations seems only necessary for relational databases, this projects comes even if you choose a NoSQL database provider (like MongoDB). In that case, it still seeds initial data which is necessary for the application. |
|||
|
|||
* Depends on the `.EntityFrameworkCore.DbMigrations` project (for EF Core) since it needs to access to the migrations. |
|||
* Depends on the `.Application.Contracts` project to be able to access permission definitions, because initial data seeder grants permissions for the admin user. |
|||
|
|||
#### .HttpApi Project |
|||
|
|||
This project is used to define your API Controllers. |
|||
|
|||
Most of time you don't need to manually define API Controllers since ABP's [Auto API Controllers](../AspNetCore/Auto-API-Controllers.md) feature creates them automagically based on your application layer. However, in case of you need to write API controllers, this is the best place to do it. |
|||
|
|||
* Depends on the `.Application.Contracts` project to be able to inject the application service interfaces. |
|||
|
|||
#### .HttpApi.Client Project |
|||
|
|||
This is a project that defines C# client proxies to use the HTTP APIs of the solution. You can share this library to 3rd-party clients, so they can easily consume your HTTP APIs in their Dotnet applications. |
|||
|
|||
`.HttpApi.Client.ConsoleTestApp` project is a console application created to demonstrate the usage of the client proxies. |
|||
|
|||
Most of time you don't need to manually create C# client proxies, thanks to ABP's [Cynamic C# API Clients](../AspNetCore/Dynamic-CSharp-API-Clients.md) feature. |
|||
|
|||
* Depends on the `.Application.Contracts` project to be able to share the same application service interfaces and DTOs with the remote service. |
|||
|
|||
#### .Web Project |
|||
|
|||
This project contains the User Interface (UI) of the application. It contains razor pages, javascript files, css files, images and so on... |
|||
|
|||
* Depends on the `.HttpApi` since UI layer needs to use APIs and application service interfaces of the solution. |
|||
|
|||
> If you check the source code of the `.Web.csproj` file, you will see the references to the `.Application` and the `.EntityFrameworkCore.DbMigrations` projects. |
|||
> |
|||
> These references are actually not needed on development, because UI layer normally doesn't depend on the EF Core or the Application implementation. This startup templates are ready for the tiered deployment, where API layer is hosted in a separate server than the UI layer. |
|||
> |
|||
> However, if you don't choose the `--tiered` option, these references will be in the .Web project to be able to host the Web, API and application layers in a single application endpoint. |
|||
> |
|||
> This gives you to ability to use domain entities in your presentation layer. However, this is considered as a bad practice according to the DDD. |
|||
|
|||
#### Test Projects |
|||
|
|||
The solution has multiple test projects, one for each layer: |
|||
|
|||
* `.Domain.Tests` is used to test the domain layer. |
|||
* `.Application.Tests` is used to test the application layer. |
|||
* `.EntityFrameworkCore.Tests` is used to test EF Core configuration and custom repositories. |
|||
* `.Web.Tests` is used to test the UI. |
|||
* `.TestBase` is a base (shared) project for all tests. |
|||
|
|||
In addition, `.HttpApi.Client.ConsoleTestApp` is a console application (not an automated test project) which demonstrate the usage of HTTP APIs from a Dotnet application. |
|||
|
|||
### Tiered Structure |
|||
|
|||
TODO |
|||
|
|||
### Other Database Providers |
|||
|
|||
TODO |
|||
|
|||
#### MongoDB |
|||
|
|||
TODO |
|||
|
After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
@ -0,0 +1,3 @@ |
|||
## Value Types |
|||
|
|||
TODO |
|||
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 12 KiB |