Perigon.templates 1.3.16

dotnet new install Perigon.templates@1.3.16
                    
This package contains a .NET Template Package you can call from the shell/command line.

Perigon.templates

Perigon.templates是基于Aspire,ASP.NET Core和Entity Framework Core的快速开发模板,提供一个设计良好的项目工程结构。

模板已被集成在Perigon.CLI代码辅助工具中,建议使用该命令行工具来创建解决方案,以获得更好的体验。

要求

  • .NET 10.0 SDK(建议 10.0.103 或兼容的 .NET 10 SDK)
  • Aspire CLI/SDK 13.5.0(与模板包 1.3.16 对应)

文档

关于模板详细的说明和使用方法,请查阅使用文档!

安装

使用源代码安装

  • 拉取源代码
  • 执行install.ps1脚本安装。

使用Nuget安装

模板已经发布到nuget上,请根据你的项目版本下载对应的模板。

dotnet new install Perigon.templates --version 1.3.16

模板说明

当前仓库提供两套可选模板:

  • MiniApi:面向轻量接口服务,优先采用 Minimal API、NativeAOT、Request Delegate Generator 与 Perigon.PostgreSQL,适合高性能、低资源开销、对 AI 工具友好的后端服务。模板短名称为 perigon-miniapi。
  • ApiStandard:面向传统 Web API 场景,基于 ASP.NET Core Web API、EF Core 与 Aspire,适合需要标准 MVC/Web API 生态、模块化组织和更传统开发方式的项目。

MiniApi 模板的作用与使用场景

MiniApi 模板适合以下场景:

  • 需要构建轻量级 API 服务,启动快、内存占用低。
  • 希望优先使用 Minimal API 与 NativeAOT,获得更好的发布性能和运行效率。
  • 需要与 AI/代码生成工具配合时,代码结构更直接、层次更清晰。
  • 适用于网关、微服务、数据接口、内部系统接口等对性能和部署成本敏感的项目。

创建项目

下面给出两套模板的创建命令示例:

创建 MiniApi 模板

dotnet new perigon-miniapi -n MyMiniApi

创建 ApiStandard 模板

dotnet new perigon-webapi -n MyWebApi

如果你想指定模板名称并直接生成到当前目录,也可以这样:

dotnet new perigon-miniapi -n <projectname>
dotnet new perigon-webapi -n <projectname>

数据库

  • ApiStandard 支持在 AppHost 的 Components:Database 中选择 PostgreSQL 或 SqlServer。
  • MiniApi 固定使用 PostgreSQL,数据访问通过 Perigon.PostgreSQL 提供。

数据迁移

ApiStandard 使用 EF Core 和 Aspire AddEFMigrations。修改实体后,在 ApiStandard 目录运行 .\scripts\EFMigrations.ps1 Init 生成迁移;EF CLI 使用默认的 AdminService 作为启动项目,AppHost 启动或发布的 Kubernetes Job 会执行迁移。

MiniApi 不包含 EF Core 迁移服务,也不要求运行该迁移脚本;请按项目的 PostgreSQL 数据访问约定管理数据库变更。

运行项目

使用 Aspire CLI 启动 AppHost:

aspire start --non-interactive

模板默认不包含 SystemMod,因此不会预置可登录的管理员账号。安装模块后请按模块文档初始化账号,不要把示例凭据带入生产环境。

  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.16 38 9/24/2026
1.3.15 122 8/31/2026
1.3.14 131 8/27/2026
1.3.13 124 8/26/2026
1.3.12 155 8/13/2026
1.3.11 173 7/29/2026
1.3.10 193 7/22/2026
1.3.9 190 7/20/2026
1.3.8 194 7/17/2026
1.3.7 188 7/14/2026
1.3.6 205 7/2/2026
1.3.3 266 5/20/2026
1.3.1 269 5/6/2026
1.3.0 273 4/30/2026
1.2.7 302 4/16/2026
1.2.6 317 3/31/2026
1.2.5 322 3/26/2026
1.2.4 315 3/24/2026
1.2.3 322 3/24/2026
1.2.2 339 3/16/2026
Loading failed

1. Unify ApiStandard and MiniApi source generation, including automatic Minimal API endpoint group registration; update MiniApi JSON and Native AOT wiring.
2. Improve data access safety and correctness for partial updates, bulk inserts, and nested Between queries.
3. Expose valid role_id claims through IUserContext.RoleIds and standardize ApiStandard invalid-model-state responses as HTTP 400 with title, detail, status, and trace ID.
4. Remove the built-in image captcha helper and ImageSharp dependency. Existing callers of ImageHelper.GenerateImageCaptcha must migrate.
5. Improve GenSwagger.ps1 by restoring its local tool manifest and explicitly building before Swagger generation.