NetCorePal.Template 2.9.2

dotnet new install NetCorePal.Template::2.9.2
                    
This package contains a .NET Template Package you can call from the shell/command line.

工程模板

Release Build Preview Build NuGet MyGet Preview GitHub license

简介

本项目是一个基于dotnet new的模板项目,用于快速创建一个基于 netcorepal-cloud-framework 的项目。

项目支持linuxwindowsmacOS平台。

前提条件

  1. 安装.NET 9.0 SDK或更高版本。

    SDK下载地址: https://dot.net/download

  2. 拥有Docker环境,用于自动化单元测试和集成测试。

    Docker Desktop下载地址: https://www.docker.com/products/docker-desktop/

如何使用

安装模板

dotnet new install NetCorePal.Template

安装Preview版本

dotnet new install NetCorePal.Template::<package-version> --add-source "https://www.myget.org/F/netcorepal/api/v3/index.json"

创建项目

dotnet new netcorepal-web -n My.Project.Name

进入项目目录

cd My.Project.Name

构建项目

dotnet build

运行测试

dotnet test

其它命令

更新模板

dotnet new update

or

dotnet new install NetCorePal.Template::<VERSION>

卸载模板

dotnet new uninstall NetCorePal.Template

IDE 代码片段配置

本模板提供了丰富的代码片段,帮助您快速生成常用的代码结构。

代码片段演示

Visual Studio 配置

运行以下 PowerShell 命令自动安装代码片段:

cd vs-snippets
.\Install-VSSnippets.ps1

或者手动安装:

  1. 打开 Visual Studio
  2. 转到 工具 > 代码片段管理器
  3. 导入 vs-snippets/NetCorePalTemplates.snippet 文件

VS Code 配置

VS Code 的代码片段已预配置在 .vscode/csharp.code-snippets 文件中,打开项目时自动生效。

JetBrains Rider 配置

Rider 用户可以直接使用 ABC.Template.sln.DotSettings 文件中的 Live Templates 配置。

可用的代码片段

NetCorePal (ncp) 快捷键
快捷键 描述 生成内容
ncpcmd NetCorePal 命令 ICommand 实现(含验证器和处理器)
ncpcmdres 命令(含返回值) ICommand<Response> 实现
ncpar 聚合根 Entity<Id> 和 IAggregateRoot
ncprepo NetCorePal 仓储 IRepository 接口和实现
ncpie 集成事件 IntegrationEvent 和处理器
ncpdeh 域事件处理器 IDomainEventHandler 实现
ncpiec 集成事件转换器 IIntegrationEventConverter
ncpde 域事件 IDomainEvent 记录
Endpoint (ep) 快捷键
快捷键 描述 生成内容
epp FastEndpoint(NCP风格) 完整的垂直切片实现
epreq 仅请求端点 Endpoint<Request>
epres 仅响应端点 EndpointWithoutRequest<Response>
epdto 端点 DTOs Request 和 Response 类
epval 端点验证器 Validator<Request>
epmap 端点映射器 Mapper<Request, Response, Entity>
epfull 完整端点切片 带映射器的完整实现
epsum 端点摘要 Summary<Endpoint, Request>
epnoreq 无请求端点 EndpointWithoutRequest
epreqres 请求响应端点 Endpoint<Request, Response>
epdat 端点数据 静态数据类

代码分析可视化

框架提供了强大的代码流分析和可视化功能,帮助开发者直观地理解DDD架构中的组件关系和数据流向。

🎯 核心特性

  • 自动代码分析:通过源生成器自动分析代码结构,识别控制器、命令、聚合根、事件等组件
  • 多种图表类型:支持架构流程图、命令链路图、事件流程图、类图等多种可视化图表
  • 交互式HTML可视化:生成完整的交互式HTML页面,内置导航和图表预览功能
  • 一键在线编辑:集成"View in Mermaid Live"按钮,支持一键跳转到在线编辑器

🚀 快速开始

安装命令行工具来生成独立的HTML文件:

# 安装全局工具
dotnet tool install -g NetCorePal.Extensions.CodeAnalysis.Tools

# 进入项目目录并生成可视化文件
cd My.Project.Name/src/My.Project.Name.Web
netcorepal-codeanalysis generate --output architecture.html

✨ 主要功能

  • 交互式HTML页面

    • 左侧树形导航,支持不同图表类型切换
    • 内置Mermaid.js实时渲染
    • 响应式设计,适配不同设备
    • 专业的现代化界面
  • 一键在线编辑

    • 每个图表右上角的"View in Mermaid Live"按钮
    • 智能压缩算法优化URL长度
    • 自动跳转到Mermaid Live Editor
    • 支持在线编辑、导出图片、生成分享链接

📖 详细文档

完整的使用说明和示例请参考:

支持特性(WIP)

  • 文件存储
    • 本地文件
    • 阿里云对象存储
  • 配置管理
    • 文件配置(json、ini、yaml)
    • Kubernetes ConfigMap
    • Nacos
    • Apollo
    • AgileConfig
  • 数据库
    • InMemory
    • SqlServer
    • MySql
    • PostgreSql
    • Sqlite
  • 消息队列
    • RabbitMQ
    • Kafka
    • RedisStreams
    • AzureServiceBus
    • AmazonSQS
    • Pulsar
  • 服务注册发现
    • Kubernetes
    • Etcd
    • Consul
    • Zookeeper
    • Eureka
    • Nacos
  • API工具链
    • Swagger
  • 远程调用
    • gRPC
    • HttpClient
  • 实时通讯
    • SignalR
    • WebSocket
  • 缓存中间件
    • Redis
  • 熔断限流
    • Polly
  • net8.0

    • No dependencies.
  • net9.0

    • 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
2.9.2 138 8/8/2025
2.9.0 170 8/5/2025
2.8.0 141 7/11/2025
2.7.3 119 6/28/2025
2.7.2 131 6/27/2025
2.7.1 305 6/12/2025
2.7.0 237 5/16/2025
2.6.1 179 3/28/2025
2.6.0 436 3/24/2025
2.5.1 160 3/14/2025
2.5.0 191 3/11/2025
2.4.2 247 3/5/2025
2.4.1 229 3/5/2025
2.4.0 168 2/26/2025
2.3.0 143 2/20/2025
2.2.1 137 1/16/2025
2.2.0 95 1/15/2025
2.1.0 103 1/10/2025
2.0.0 177 12/15/2024
1.5.1 206 9/2/2024
1.5.0 134 9/1/2024
1.4.0 213 8/11/2024
1.3.0 131 7/29/2024
1.2.0 193 7/13/2024
1.1.1 2,942 12/11/2023
1.1.0 299 12/8/2023
1.1.0-rc.2 422 11/25/2023
1.1.0-rc.1 397 11/12/2023
1.0.0 421 9/21/2023