鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2021.1.7基础设施层架构培训.md 1.0KB

123456789101112131415161718192021
  1. - 领域模型:在`DD.Libs`类库中
  2. - 上下文:在`DD.Infra`类库中
  3. ```
  4. --本质上上下文派生了Entity Framework Core的DbContext, 同时也实现了工作者单元接口IUnitOfWork
  5. --上下文中的DbSet对应数据库的表
  6. ```
  7. - 为了完成数据库迁移,需要在`DD.OfficeBuilding.Web`项目中引入迁移所需的几个关键组件
  8. ```
  9. <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
  10. <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
  11. <PrivateAssets>all</PrivateAssets>
  12. <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  13. </PackageReference>
  14. <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc1.final" />
  15. <PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
  16. ```
  17. - 在`DD.OfficeBuilding.Web`项目中开始迁移
  18. ```
  19. --生成迁移文件:dotnet ef migrations add initial -c DDOfficeContext
  20. --生成数据库:dotnet ef database update -c DDOfficeContext
  21. ```