概述
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.12" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="5.21.4" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
虽然用了.NET 6,但是这些包的版本,不可以追求最新,否则有很多莫名其妙的错误。到处查资料,结果无解。
比如:
System.TypeLoadException:“Method ‘GetServiceProviderHashCode’ in type ‘ExtensionInfo’ from assembly ‘Oracle.EntityFrameworkCore, Version=5.0.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342’ does not have an implementation.”
比如
System.InvalidOperationException:“No database provider has been configured for this DbContext. A provider can be configured by overriding the ‘DbContext.OnConfiguring’ method or by using ‘AddDbContext’ on the application service provider. If ‘AddDbContext’ is used, then also ensure that your DbContext type accepts a DbContextOptions object in its constructor and passes it to the base constructor for DbContext.”
最后
以上就是傲娇大叔为你收集整理的【原创】ASP.NET Core WebApi 6 + Oralce EF Core配置的全部内容,希望文章能够帮你解决【原创】ASP.NET Core WebApi 6 + Oralce EF Core配置所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复