Perigon.templates 1.3.14

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

Perigon.templates

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

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

要求

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

文档

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

安装

使用源代码安装

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

使用Nuget安装

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

dotnet new install Perigon.templates --version 1.3.14

模板说明

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

  • 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 中选择 PostgreSQLSqlServer
  • 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.14 45 8/27/2026
1.3.13 62 8/26/2026
1.3.12 105 8/13/2026
1.3.11 129 7/29/2026
1.3.10 145 7/22/2026
1.3.9 142 7/20/2026
1.3.8 145 7/17/2026
1.3.7 144 7/14/2026
1.3.6 165 7/2/2026
1.3.3 232 5/20/2026
1.3.1 232 5/6/2026
1.3.0 239 4/30/2026
1.2.7 259 4/16/2026
1.2.6 280 3/31/2026
1.2.5 285 3/26/2026
1.2.4 279 3/24/2026
1.2.3 283 3/24/2026
1.2.2 302 3/16/2026
1.2.1 295 3/8/2026
1.2.0 294 3/3/2026
Loading failed

1. Make ApiStandard tenant resolution fail closed: authenticated requests require a valid TenantId, and unknown tenant IDs no longer fall back to the catalog default connection.
2. Seed the default.com tenant with the default and analysis connection strings, while preserving the system tenant catalog context.
3. Align the templates with multi-tenant defaults and tenant-aware claims, caching, filtering, and database context behavior.