出现问题1
PM> add-migration v1.1
Build started...
Build succeeded.
Microsoft.EntityFrameworkCore.Model.Validation[10400]
Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 5.0.12 initialized 'DefaultDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=TestFur.Database.Migrations
To undo this action, use Remove-Migration.
解决方式
检查实体类 是否公开 public 文章来源:https://www.toymoban.com/news/detail-478617.html
出现问题2
Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Culture=neutral, PublicKeyToken=null'. 系统找不到指定的文件。
解决方式
Migrations.csproj 中增加节点
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.12" />
</ItemGroup>文章来源地址https://www.toymoban.com/news/detail-478617.html
到了这里,关于在NET5中 使用code first 进行数据迁移 常见的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!