Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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


    }

}
like image 460
whoami Avatar asked Oct 09 '19 10:10

whoami


1 Answers

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.

like image 178
LouisGordon Avatar answered Oct 17 '22 14:10

LouisGordon