Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 9.0功能展望 #4

Open
niltor opened this issue May 8, 2024 · 0 comments
Open

[Feature] 9.0功能展望 #4

niltor opened this issue May 8, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@niltor
Copy link
Contributor

niltor commented May 8, 2024

功能更新

进一步简化架构

  • 移除CommandSetQuerySet及相关接口定义。
  • 将基础数据库操作方法从CommandSetQuerySet移动到ManagerBase.cs,并加以改进和实现
  • 简化Manager的实现和泛型依赖,当前只需要依赖TEntity

基础组件依赖更新

  • 默认集成.NET Aspire
  • 使用新的xml格式的解决方案(当前官方对该格式支持还不完善)
  • 添加 速率限制中间件
  • 添加 本地化(多语言)支持

模板生成变更

  • 简化Manager的生成内容。原分页查询FilterAsync修改成ToPageAsync
  • Manager增加了GetDetailAsync的默认实现,并使用新的DetailDto类型
  • 修改了ManagerController中添加,更新,删除的返回类型
    • 添加后不再返回实体,而是返回新添加的Id,
    • 更新和删除返回bool,不再返回实体

生产力更新

  • 新的基于.NET9的 dry工具
  • 更加规范的代码生成
  • TODO:更多扩展方法和基础实现

性能提升

  • 添加删除(批量),而无需查询的默认实现
  • 修改接口的默认实现的返回类型,减少返回内容;添加新的DetailDto,避免直接返回实体类型携带了更多信息

模板

9.0 主要会引用两个重要的内容,以便更好的支持微服务项目的开发。

同时对于很多应用来说,单体应用仍然是非常合适的选择,目前计划未来的模板分为两个类型:

  1. Standard:标准模板,默认集成.NET Aspire.
  2. Light:轻量模板

以上三个模板分别对应不同场景和技术目标的实现,以下说明其主要区别.

Light模板

该模板使用三层结构:

  • Definition:定义层,含实体、数据库上下文、DTO的定义。
  • Application:应用逻辑实现层,主要以ServicesManager来封装。
  • Http.API:接口开放层,对外提供基于Http协议的REST API访问。

该模板非常适合开发中小型单体应用。

Standard标准模板

该模板包括:

  • Definition/Entity:实体定义
  • Definition/EntityFramework:数据库上下文定义
  • Definition/Share:DTO定义
  • Application:应用实现,主要是各实体Manager的实现
  • Http.API:接口开放层,对外提供基于Http协议的REST API访问。
  • Modules: 模块拆分 ,每个模块包含自己的 Dto,Manager,Controller
  • Microservice:其他服务的

可以看到标准模板对定义层有更细致的拆分,以便更好的复用。

此外,标准模板可使用Modules来进行关注点分离,更好的组织代码,我们也将基于Modules将常用的功能集成进去。

此模板非常适合具有多功能模块应用。

Microservice模板

我们不单独提供微服务模板,直接使用Standard标准模板即可。

当我们要将业务拆分成多个服务时,每个微服务都可以使用Light模板保持其轻量性和快速开发。

主体服务(通常为管理中台),可能拆分成多个模块;而微服务可以直接在Standard中的Microservice目录下。

使用微服务,目录结构如下:

  • Infrasturcture
    • ServiceDefaults(服务基础配置)
    • Ater.Web.Core
    • Ater.Web.Abstraction
    • Ater.Web.Extension
  • AppHost (.NET Aspire本地开发时的启动项目)
  • Definiation
  • Application
  • Http.API
  • Microservice
    • ServiceA
      • Definition
      • Application
      • ApiService
    • ServiceB
      • Definition
      • Application
      • ApiService
  • ServiceClient(可选)
    • ServiceAClient
    • ServiceBClient

其中ServiceClient是各服务的调用封装(HttpClient).

可以看到,每个微服务都包含基础的三层结构,互相独立。

IdentityServer的选择待定,潜在的方案是:

  • Microsoft Entra ID
  • 基于OpenIDDict开发带管理页面的类库
  • 直接集成SimpleIdServer
@niltor niltor added this to the 9.0 milestone Aug 23, 2024
@niltor niltor added the enhancement New feature or request label Aug 23, 2024
@niltor niltor self-assigned this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant