Loading...
Loading...
Compare original and translation side by side
| Aspect | Description |
|---|---|
| Input | Project name, entity list, configuration options |
| Output | Complete .NET solution with layered architecture |
| Target | .NET 10+, ASP.NET Core |
| 方面 | 描述 |
|---|---|
| 输入 | 项目名称、实体列表、配置选项 |
| 输出 | 具有分层架构的完整.NET解决方案 |
| 目标框架 | .NET 10+、ASP.NET Core |
| Phase | Name | Actions | Output |
|---|---|---|---|
| 1 | Receive Context | Get project name, entities, options from coordinator | Configuration |
| 2 | Create Solution | Create .sln and .csproj files | Empty solution structure |
| 3 | Generate Domain | Create entities, enums, base classes | Domain project files |
| 4 | Generate API | Create controllers, DTOs, middleware | API project files |
| 5 | Verify | Build solution, check references | Build success |
| 阶段 | 名称 | 操作 | 输出 |
|---|---|---|---|
| 1 | 接收上下文 | 从协调器获取项目名称、实体和选项 | 配置信息 |
| 2 | 创建解决方案 | 创建.sln和.csproj文件 | 空解决方案结构 |
| 3 | 生成领域层 | 创建实体、枚举、基类 | 领域层项目文件 |
| 4 | 生成API层 | 创建控制器、DTO、中间件 | API层项目文件 |
| 5 | 验证 | 构建解决方案,检查引用 | 构建成功 |
| Input | Type | Required | Description |
|---|---|---|---|
| string | Yes | Solution and project name prefix |
| string | Yes | Directory for generated solution |
| string | Yes | .NET version (e.g., net10.0) |
| list | Yes | Entity names to generate |
| list | Yes | Feature groupings for MockData |
| Option | Default | Effect |
|---|---|---|
| true | Add Swashbuckle for API docs |
| true | Add structured logging |
| true | Add health endpoints |
| true | Generate mock data classes |
| 输入 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| string | 是 | 解决方案和项目名称前缀 |
| string | 是 | 生成解决方案的目录 |
| string | 是 | .NET版本(例如:net10.0) |
| list | 是 | 要生成的实体名称 |
| list | 是 | MockData的功能分组 |
| 选项 | 默认值 | 作用 |
|---|---|---|
| true | 添加Swashbuckle用于API文档 |
| true | 添加结构化日志 |
| true | 添加健康检查端点 |
| true | 生成模拟数据类 |
| Step | Action | Reference |
|---|---|---|
| 2.1 | Create solution directory | — |
| 2.2 | Generate .sln file | — |
| 2.3 | Create project directories | |
| 2.4 | Generate .csproj files per layer | |
| 2.5 | Add project references | |
| Project | Purpose |
|---|---|
| HTTP endpoints, middleware |
| Entities, enums |
| Business logic interfaces |
| Data access interfaces |
| Cross-cutting utilities |
| 步骤 | 操作 | 参考 |
|---|---|---|
| 2.1 | 创建解决方案目录 | — |
| 2.2 | 生成.sln文件 | — |
| 2.3 | 创建项目目录 | |
| 2.4 | 为每个层生成.csproj文件 | |
| 2.5 | 添加项目引用 | |
| 项目 | 用途 |
|---|---|
| HTTP端点、中间件 |
| 实体、枚举 |
| 业务逻辑接口 |
| 数据访问接口 |
| 横切关注点工具类 |
| Step | Action | Reference |
|---|---|---|
| 3.1 | Create | |
| 3.2 | Generate entity classes per input | |
| 3.3 | Generate status enums | |
| 3.4 | Create folder structure | |
| Entity Property | Generated As |
|---|---|
| Primary key | |
| String field | |
| Status field | |
| Timestamps | |
| 步骤 | 操作 | 参考 |
|---|---|---|
| 3.1 | 创建 | |
| 3.2 | 根据输入生成实体类 | |
| 3.3 | 生成状态枚举 | |
| 3.4 | 创建文件夹结构 | |
| 实体属性 | 生成格式 |
|---|---|
| 主键 | |
| 字符串字段 | |
| 状态字段 | |
| 时间戳 | 来自BaseEntity的 |
| Step | Action | Reference |
|---|---|---|
| 4.1 | Generate Program.cs | |
| 4.2 | Generate controllers per entity | |
| 4.3 | Generate DTOs per entity | |
| 4.4 | Generate middleware classes | |
| 4.5 | Generate extension methods | |
| 4.6 | Generate MockData classes (if enabled) | |
| 4.7 | Add NuGet packages | |
| Endpoint | Method | Route |
|---|---|---|
| GetAll | GET | |
| GetById | GET | |
| Create | POST | |
| Update | PUT | |
| Delete | DELETE | |
| 步骤 | 操作 | 参考 |
|---|---|---|
| 4.1 | 生成Program.cs | |
| 4.2 | 为每个实体生成控制器 | |
| 4.3 | 为每个实体生成DTO | |
| 4.4 | 生成中间件类 | |
| 4.5 | 生成扩展方法 | |
| 4.6 | 生成MockData类(如果启用) | |
| 4.7 | 添加NuGet包 | |
| 端点 | 请求方法 | 路由 |
|---|---|---|
| GetAll | GET | |
| GetById | GET | |
| Create | POST | |
| Update | PUT | |
| Delete | DELETE | |
| Check | Command | Expected |
|---|---|---|
| Solution builds | | Success, no errors |
| Project references | Check .csproj | All references valid |
| Files created | Directory listing | All expected files present |
| 检查项 | 命令 | 预期结果 |
|---|---|---|
| 解决方案构建 | | 成功,无错误 |
| 项目引用 | 检查.csproj文件 | 所有引用有效 |
| 文件创建 | 目录列表 | 所有预期文件已存在 |
| Layer | Folders | Files per Entity |
|---|---|---|
| Api | Controllers/, DTOs/, Middleware/, MockData/, Extensions/ | Controller, DTO |
| Domain | Entities/, Enums/, Common/ | Entity, Status enum |
| Services | Interfaces/ | Interface (stub) |
| Repositories | Interfaces/ | Interface (stub) |
| Shared | — | Utility classes |
| 层级 | 文件夹 | 每个实体对应的文件 |
|---|---|---|
| Api | Controllers/、DTOs/、Middleware/、MockData/、Extensions/ | 控制器、DTO |
| Domain | Entities/、Enums/、Common/ | 实体、状态枚举 |
| Services | Interfaces/ | 接口(存根) |
| Repositories | Interfaces/ | 接口(存根) |
| Shared | — | 工具类 |
dotnet builddotnet builddotnet builddotnet build| Risk | Detection | Mitigation |
|---|---|---|
| Build failure | | Check .csproj references, verify SDK version |
| Missing references | CS0246 errors | Add missing project references |
| Invalid entity names | Build or runtime errors | Validate entity names before generation |
| Path conflicts | File exists errors | Check target path, prompt before overwrite |
| Package restore failure | NuGet errors | Verify network, check package names |
| 风险 | 检测方式 | 缓解措施 |
|---|---|---|
| 构建失败 | | 检查.csproj引用,验证SDK版本 |
| 缺少引用 | CS0246错误 | 添加缺失的项目引用 |
| 无效实体名称 | 构建或运行时错误 | 在生成前验证实体名称 |
| 路径冲突 | 文件已存在错误 | 检查目标路径,覆盖前提示 |
| NuGet包还原失败 | NuGet错误 | 验证网络连接,检查包名称 |
| File | Purpose |
|---|---|
| Project organization, folder structure, dependencies |
| Entity generation rules, property patterns |
| Controller and DTO generation rules |
| Program.cs structure and service registration |
| Required and optional NuGet packages |
| 文件 | 用途 |
|---|---|
| 项目组织、文件夹结构、依赖关系 |
| 实体生成规则、属性模式 |
| 控制器和DTO生成规则 |
| Program.cs结构和服务注册 |
| 必填和可选的NuGet包 |