Zeek.Plus.Templates 10.0.5
Zeek.Plus.Templates
Zeek.Plus.Templates 是 PlusFramework 的 dotnet new 模板包。
它只负责生成推荐项目骨架,不是运行时模块,不参与 PlusApplication 依赖图。
安装
dotnet new install Zeek.Plus.Templates --nuget-source https://baget.pluscode.cn/v3/index.json
本地验证 .nupkg 时可以使用:
dotnet new uninstall Zeek.Plus.Templates
dotnet new install .\.artifacts\templates-plus\Zeek.Plus.Templates.10.0.5.nupkg --force
模板
dotnet new plus -n Commerce
plus 生成一个可 restore/build/test 的干净模块化单体解决方案,默认包含 HttpApi.Host、DbMigrator、Catalog、测试项目、NuGet.config、README.md 和 .http 文件。
新增业务模块时,可以复制生成项目中的 Catalog 模块后按业务名称自行改名,再显式接入 Host、DbMigrator 和 solution。
参数
日常使用只需要:
dotnet new plus -n Commerce --database PostgreSql
dotnet new plus -n Commerce --database Sqlite
dotnet new plus -n Commerce --database PostgreSql --aspire true
完整参数如下:
-n:项目名,参与 solution、Host、DbMigrator、测试项目和默认应用壳 namespace。--database:支持PostgreSql、SqlServer、MySql、Sqlite,默认PostgreSql。--aspire:是否生成AppHost与ServiceDefaults,默认false。--root-namespace:生成 Host、DbMigrator 和测试代码的根 namespace,默认使用项目名;业务模块保持自身 namespace。--framework-version:生成项目引用的Zeek.Plus.*包版本,默认10.0.1。
约束
生成项目默认引用 Zeek.Plus.* NuGet 包,不引用当前仓库 PlusFramework/src。
模板业务代码直接使用 Facet source generator 演示 DTO 映射,不生成 Zeek.Plus.Mapping 模块,也不依赖运行时 IObjectMapper。
生成项目默认不包含全局 using 文件,并设置 ImplicitUsings=disable;模板源码文件显式声明自身 using。
--database MySql 会在 HttpApi.Host 与 DbMigrator 的 appsettings.json 中输出默认 EntityFrameworkCore:MySql:ServerVersion,避免启动期自动探测数据库版本。
--aspire true 只影响生成项目的开发期编排输出,不会让 PlusFramework 运行时模块依赖 Aspire。AppHost 从自身配置读取 ConnectionStrings:Catalog,并注入给 DbMigrator 与 HttpApi.Host;模板会在 AppHost/appsettings.Development.json 中生成本地开发默认连接串。
模板不会生成真实密码、API key、token、前端、Administration、PermissionManagement、Identity 平台、网关、认证中心、Redis、工作流或 MongoDB。
.NET 10.0
- No dependencies.