Skip to content

Commit

Permalink
update web docs
Browse files Browse the repository at this point in the history
  • Loading branch information
niltor committed Feb 29, 2024
1 parent 37ea241 commit 1cc74c5
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 70 deletions.
30 changes: 15 additions & 15 deletions en/ater.dry/Create and run project.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create and run projects
# Create and run project

## create solutions
## Create solutions

Click the Create button to go to the solution creation page.

Expand All @@ -10,16 +10,16 @@ You will see the following page, please fill in the solution name and local path

:::image type="content" source="../ images/createSolutionPage.jpg" alt-text="create solution page":::

## run the solution
## Run the solution

Now open the solution using your favorite IDE, or click the Open button directly in Studio.

### profile
### Configuration

Please check the configuration file contents first, including:

- Configure database connection strings. Please configure the relevant connection strings in`ConnectionStrings` in`appsettings.json` under`Http.API`project.
- `Cache`configuration of`Components` in configuration file, optional "Redis" or "Memory".
- Configure database connection strings. Please configure the relevant connection strings in `ConnectionStrings` in `appsettings.json` under `Http.API` project.
- `Cache` configuration of `Components` in configuration file, optional "Redis" or "Memory".

You can refer to the following configuration instructions:

Expand Down Expand Up @@ -62,24 +62,24 @@ You can refer to the following configuration instructions:
},
```

### database migration
### Database migration

The template uses PostgreSQL by default. If you use another database provider, you can find the method for injecting database services in`Application` project`AppServiceCollectionExtensions.cs`
The template uses PostgreSQL by default. If you use another database provider, you can find the method for injecting database services in `Application` project `AppServiceCollectionExtensions.cs`

Please use`dotnet ef` command to generate migration code under`Http.API`project. Or run`EFMigrations.ps1` script directly, such as:
Please use `dotnet ef` command to generate migration code under `Http.API` project. Or run `EFMigrations.ps1` script directly, such as:

```powershell
.\EFMigrations.ps1 Init
```

### run the project
### Run the project

Since 8.0 added support for`.NET Aspire`, you now have two ways to run programs.
<!-- Since 8.0 added support for `.NET Aspire`, you now have two ways to run programs.
1. Run`AppHost` project, which is run using the way Aspire provides it, and it will open`Dashboard`.
2. Run`Http.API` project directly, which opens the`Swagger UI`of the interface in the browser.
1. Run `AppHost` project, which is run using the way Aspire provides it, and it will open `Dashboard`. -->
Run `Http.API` project directly, which opens the `Swagger UI` of the interface in the browser.

You can choose the appropriate way to run the program.
<!-- You can choose the appropriate way to run the program. -->

> [!NOTE]
>When the interface program runs, it automatically commits migration and creates default users. If you want to change this behavior, modify the code in`InitDataTask.cs`
> When the interface program runs, it automatically commits migration and creates default users. If you want to change this behavior, modify the code in `InitDataTask.cs`
30 changes: 15 additions & 15 deletions en/ater.dry/Install.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# installation
# Install

## premise
## Require

- Installing the[`.NET SDK`](https://dotnet.microsoft.com/zh-cn/download)
- Installing the [`.NET SDK`](https://dotnet.microsoft.com/zh-cn/download)

## version
## Version

First check the package version, the tool depends on the. NET SDK, and the corresponding relationship is as follows:

|Package Version|.NET SDK Version| support|
|-|-|-|
|8.x| 8.0+| current version|

## installation tool
## Install tool

Use`dotnet tool` command to install:
Use `dotnet tool` command to install:

```pwsh
dotnet tool install --global ater.dry
```

You can check the latest version in[nuget](https://www.nuget.org/packages/ater.dry)!
You can check the latest version in [nuget](https://www.nuget.org/packages/ater.dry)!

## use
## Use

### Using graphical interfaces
### use the Web UI

One command to start the UI!

Expand All @@ -33,19 +33,19 @@ dry studio
```

> [!NOTE]
>If a new version is installed, run`dry studio update` before starting Studio.
>If a new version is installed, run `dry studio update` before starting Studio.
### using the command line
### use the command line

You can use`dry --help` check command help information.
You can use `dry --help` check command help information.

Or use`dry[command] --help` see specific command help information.
Or use `dry[command] --help` see specific command help information.

> [!TIP]
>Using command-line tools, you can generate relevant code independently of the project structure! Because you can specify specific entity paths and code output paths.
## next
## Next step

Congratulations on successfully installing and running the tool.

You can now[create](创建并运行项目.md) new solution projects using this tool.
You can now [create](创建并运行项目.md) new solution projects using this tool.
18 changes: 9 additions & 9 deletions en/ater.dry/Overview.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Ater.Dry

**Dry**comes from the principle of`don't repeat yourself`!
**Dry**comes from the principle of `don't repeat yourself`!

**Dry**is an intelligent code assistance tool, mainly provides code generation function, it can analyze your entity, intelligent help you generate related data transfer objects, database read and write operations and API interfaces.
To reduce repetitive template coding efforts.

It is available as`dotnet` command-line tool and supports a`Web UI`.
It is available as `dotnet` command-line tool and supports a `Web UI`.

## characteristics
## Feature

- Intelligent analytics based on entity models to understand user business intent
- Intelligent generation of DTO files, including add, update, query, list and other common DTO
Expand All @@ -23,11 +23,11 @@ It is available as`dotnet` command-line tool and supports a`Web UI`.

The dry command tool helps developers generate common code templates from solid models (.cs files), including:

- Dto file, add, update, query, list, etc. Dto file
- Storage file, data storage layer code
- controller file
- Protobuf file
- Client Request Service
- Dto file, add, update, query, list, etc. Dto files
- Manager file, Business logic layer
- Controller files
- Protobuf files
- Client Request Services

### Support for Typescript

Expand All @@ -42,4 +42,4 @@ For the front end, the code (.ts) required for the request can be generated acco

## Project template support

The tool integrates with the[ater.web.templates](https://www.nuget.org/packages/ater.web.templates) project template so you can create solutions directly using a graphical interface!
The tool integrates with the [ater.web.templates](https://www.nuget.org/packages/ater.web.templates) project template so you can create solutions directly using a graphical interface!
26 changes: 13 additions & 13 deletions en/ater.web/Overview.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# What is Ater.Web?

`Ater.Web.template`is an out-of-the-box solution template based on`ASP.NET Core`,`Entity Framework`, and`.NET Aspire`, combined with a large number of project practices to help new and old developers quickly develop application services.
`Ater.Web.template`is an out-of-the-box solution template based on`ASP.NET Core`,`Entity Framework`, and `.NET Aspire`, combined with a large number of project practices to help new and old developers quickly develop application services.

## characteristics

- Based on official technology, it is not`另一个框架`, and it is extremely versatile.
- Templates include all source code, no`框架依赖包`, transparency and focus.
- Based on official technology, it is not `Another Framework`, and it is extremely versatile.
- Templates include all source code, no `nuget package`, transparency and focus.
- For the purpose of development and maintenance efficiency, it provides layered project structure and code practice specifications, which are suitable for various scenarios such as single application, microservice, multi-person collaboration, etc.
- Provide intelligent code assistant tools to minimize repetitive work.

Expand All @@ -23,8 +23,8 @@

- Templates do not provide functionality integrations that are available without development, such as payments, CMS, authentication, etc. You need to select other options and integrate them.
- Much of our code implementation and generation is based on`Entity Framework`, and if you don't use it, you won't enjoy the convenience.
- Does not apply to interface development using`minimalAPI`style.
- The new template is based on`.NET8.0`, and older versions do not apply.
- Does not apply to interface development using `minimalAPI` style.
- The new template is based on`.NET 8.0`, and older versions do not apply.

> [!NOTE]
>Using this set of templates and development tools, your development work will be simple and orderly, with a business implementation you only need to:
Expand All @@ -34,42 +34,42 @@
>- Adjust and implement your own business logic according to the actual business.
>- Define exposed interfaces
## installation
## Install

premise

- Install[`.NET SDK 8.0`](https://dotnet.microsoft.com/zh-cn/download)
- Install [`.NET SDK 8.0`](https://dotnet.microsoft.com/zh-cn/download)

Install using`dotnet new`command.
Install using `dotnet new` command.

```pwsh
dotnet new install ater.web.templates
```

## use
## Use

After installation, you can create a project using the command or by selecting Create via VS's graphical interface (recommended).

```pwsh
dotnet new atapi -n my-project
```

Go to`Http.API` project and configure the database connection string in`appsetings.json`
Go to `Http.API` project and configure the database connection string in `appsetings.json`

> [!TIP]
>`PostgreSQL`is used by default. Please change it according to your actual needs.
## Install ater.dry (recommended)

`ater.dry`is an intelligent code assistance tool, mainly provides code generation function, it can analyze your entity, intelligently help you generate related data transfer objects, database read and write operations and API interfaces. It is provided by`dotnet` command-line tools, while providing Web UI interface, can save a lot of development time, strongly recommended installation use!
`ater.dry`is an intelligent code assistance tool, mainly provides code generation function, it can analyze your entity, intelligently help you generate related data transfer objects, database read and write operations and API interfaces. It is provided by `dotnet` command-line tools, while providing Web UI interface, can save a lot of development time, strongly recommended installation use!

```pwsh
dotnet tool install --global ater.dry
```

> [!TIP]
>This tool provides out-of-the-box support for`Ater.Web`templates!
>This tool provides out-of-the-box support for `Ater.Web` templates!
## next step

🎉Congratulations on the successful completion of the project creation, to understand the[project structure](./%E6%95%99%E7%A8%8B/%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E.md)!
🎉Congratulations on the successful completion of the project creation, to understand the [project structure](./%E6%95%99%E7%A8%8B/%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E.md)!
24 changes: 12 additions & 12 deletions en/ater.web/Quick Start.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Precondition: You have installed and created a project template

## Check the configuration file

Templates default to`PostgreSQL` as a relational database and`Redis` as distributed cache support.
Templates default to `PostgreSQL` as a relational database and `Redis` as distributed cache support.

You need to configure the connection string in`appsettings.json`and replace the default database if you want.
You need to configure the connection string in `appsettings.json`and replace the default database if you want.

## Defining Solid Models

Expand All @@ -21,18 +21,18 @@ You need to configure the connection string in`appsettings.json`and replace the
Use`dry studio` to generate`dto`,`Manager`,`Controller` and other basic code.

> [!TIP]
>For more information about`dry cli`, see[the dry cli documentation.](https://docs.dusi.dev/zh/ater.dry/%E6%A6%82%E8%BF%B0.html)
>For more information about`dry cli`, see[the dry cli documentation.](https://docs.dusi.dev/en/ater.dry/Overview.html)
## Implement custom business logic

Implement business logic in the`Application``Manager`directory, usually including`筛选查询`,`添加实体`, and`更新实体`.
Implement business logic in the`Application``Manager`directory, usually including `Filter Query`, `Add Entity`, and `Update Entity`.

### Filter query

Steps to build custom query criteria:

1. Construct your own query condition`Queryable`
2. Call`FilterAsync<T>` method to get results
1. Construct your own query condition `Queryable`
2. Call `FilterAsync<T>` method to get results

Code example:

Expand Down Expand Up @@ -70,12 +70,12 @@ public override async Task<Discuss> AddAsync(Discuss entity)

### Updating the entity

`manager`provides a`GetCurrent` method to get the current (`可写数据库上下文`) entity.
`Manager` provides a `GetCurrentAsync` method to get the current (`writable dbcontext`) entity.

In the controller, the entity will be obtained first. If it does not exist, it will directly return to`404`.

The entity update method passes two parameters, one for the entity itself and one for the submitted`DTO` object.
The entity itself is obtained by using`GetCurrent` method in the controller, and can be passed directly as a parameter.
The entity itself is obtained by using`GetCurrentAsync` method in the controller, and can be passed directly as a parameter.

Code example:

Expand All @@ -98,11 +98,11 @@ public override async Task<ResourceTypeDefinition> UpdateAsync(ResourceTypeDefin

### For more information

`manager`provides default query method for details, which can directly pass query conditions.
`Manager`provides default query method for details, which can directly pass query conditions.

If you customize queries, such as querying associated content, you need to add new methods to implement them.

`manager`provides`Query.Db` members to query directly against the current model.
`Manager`provides `Query.Db` members to query directly against the current model.

Code example:

Expand All @@ -117,9 +117,9 @@ public async Task<ResourceGroup?> FindAsync(Guid id)

### Deletion processing

Delete defaults to soft delete, and if you want to modify this behavior, set`EnableSoftDelete` to false in`CommandStoreBase`class.
Delete defaults to soft delete, and if you want to modify this behavior, set`EnableSoftDelete` to false in your `Manager` class. like:

If you want to cancel only for an entity, you can override`EnableSoftDelete`in the`XXXCommandStore`class corresponding to the entity and set it to false.
`Command.EnableSoftDelete = false;`

Deletion sometimes involves**association deletion**, example code:

Expand Down
12 changes: 6 additions & 6 deletions zh/ater.web/快速入门.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public override async Task<Discuss> AddAsync(Discuss entity)

### 更新实体

`manager`提供了`GetCurrent`方法来获取当前(`可写数据库上下文`)的实体。
`Manager`提供了`GetCurrentAsync`方法来获取当前(`可写数据库上下文`)的实体。

在控制器中,会先获取实体,如果不存在,则直接返回`404`

实体更新的方法传递两个参数,一个是实体本身,一个是提交的`DTO`对象,
实体本身是在控制器当中使用`GetCurrent`方法获取到的,直接作为参数传递过去即可。
实体本身是在控制器当中使用`GetCurrentAsync`方法获取到的,直接作为参数传递过去即可。

代码示例:

Expand All @@ -98,11 +98,11 @@ public override async Task<ResourceTypeDefinition> UpdateAsync(ResourceTypeDefin

### 详情查询

`manager`提供了默认的详情查询方法,可直接传递查询条件.
`Manager`提供了默认的详情查询方法,可直接传递查询条件.

若自定义查询,如查询关联的内容,需要添加新的方法来实现.

`manager`提供了`Query.Db`成员,可直接对当前模型进行查询。
`Manager`提供了`Query.Db`成员,可直接对当前模型进行查询。

代码示例:

Expand All @@ -117,9 +117,9 @@ public async Task<ResourceGroup?> FindAsync(Guid id)

### 删除处理

删除默认为软删除,如果想修改该行为,可在`CommandStoreBase`类中将`EnableSoftDelete`设置为false。
删除默认为软删除,如果想修改该行为,可在自己的`Manager`类中将`EnableSoftDelete`设置为false。

如果只想针对某个实体取消,可在实体对应的`XXXCommandStore`类中,覆盖`EnableSoftDelete`,将其设置为false。
`Command.EnableSoftDelete = false;`

删除有时会涉及到**关联删除**,示例代码:

Expand Down

0 comments on commit 1cc74c5

Please sign in to comment.