<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.”