出現(xiàn)問(wèn)題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.
解決方式
檢查實(shí)體類(lèi) 是否公開(kāi) public?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-478617.html
出現(xiàn)問(wèn)題2
Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Culture=neutral, PublicKeyToken=null'. 系統(tǒng)找不到指定的文件。
解決方式
Migrations.csproj 中增加節(jié)點(diǎn)
<ItemGroup>
? ? <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.12" />
</ItemGroup>文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-478617.html
到了這里,關(guān)于在NET5中 使用code first 進(jìn)行數(shù)據(jù)遷移 常見(jiàn)的問(wèn)題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!