How to fix 'Method 'get_Info' in type 'Oracle.EntityFrameworkCore does not have an implementation.'

☆樱花仙子☆ 提交于 2020-06-27 07:11:08

问题


I'm trying to connect to Oracle DB via EW. On method OnConfiguring is error:

System.TypeLoadException: 'Method 'get_Info' in type 'Oracle.EntityFrameworkCore.Infrastructure.Internal.OracleOptionsExtension' from assembly 'Oracle.EntityFrameworkCore, Version=2.0.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342' does not have an implementation.'

public class Template
{

    public int Id { get; set; }

    public string Info { get; set; }

}


class TemlateContext : DbContext

{
    public DbSet<Template> Templates { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {

        optionsBuilder.UseOracle(@"User Id = user; Password = pass; Data Source =source;

//here error


    }

}

回答1:


I noticed this started happening to me today, some time after I'd already updated to .NET Core 3 for my project and had no issues. Turns out the default scaffolding used when adding an empty mvc controller via solution explorer will add references to EF Core 3 within your web project. I do not use EF Core in our production web projects. For me it was a conflict with the test project we use which uses a different version of EF Core for some database mocking.

Anyway, for the time being I will just not add controllers via the studio options so that does not happen.




回答2:


I switch to .net core 2.2 and and everything works



来源:https://stackoverflow.com/questions/58301685/how-to-fix-method-get-info-in-type-oracle-entityframeworkcore-does-not-have

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!