鼎鼎知识库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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

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