Search code examples
mysqlmysql.dataasp.net-core-2.1entity-framework-core-2.1

Microsoft.EntityFrameworkCore 2.1-rc with MySql.Data.EntityFrameworkCore


I'm trying to use mysql with Microsoft.EntityFrameworkCore 2.1-rc-final and MySql.Data.EntityFrameworkCore 8.0.11 as provider. But when I'm trying to execute the mugrations command i get this exception: System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory..ctor(Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger`1, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.

This is my IDesignTimeDbContextFactory code implementation:

public class DesignLocationFactory:IDesignTimeDbContextFactory<LocationDbContext>
{
    public LocationDbContext CreateDbContext(string[] args)
    {
        var builder = new DbContextOptionsBuilder<LocationDbContext>();
            builder.UseMySQL("server=localhost;port=3306;user=***;passsword=***;database=locationdb");
        return new LocationDbContext(builder.Options);
    }
}

Please how can I fix this or at least some sample of how to use with another providers


Solution

  • Finally, with this provider Pomelo.EntityFrameworkCore.MySql version 2.1.0-rc1-final everything works perfect. To install it execute the command: Install-Package Pomelo.EntityFrameworkCore.MySql -Version 2.1.0-rc1-final