I am trying to connect my web API to the MySql database with this code:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
string conn_string = "server=server;database=database;uid=uid;pwd=pwd;";
MySqlConnection conn = new MySqlConnection(conn_string);
services.AddDbContext<TaskContext>(options =>
{
options.UseMySQL(conn);
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMvc();
}
}
But I always get a System.TypeLoadException with this description:
System.TypeLoadException: "Clone method in type 'MySQL.Data.EntityFrameworkCore.Infraestructure.Internal.MySQLOptionsExtension' from the assembly 'MySql.Data.EntityFrameworkCore, Version = 8.0.8.0, Culture = neutral, PublicKeyToken = c5697fc "
I am using Microsoft Visual Studio Community 2017 Preview (2) and my project is in .NET Core 2.0. I also use MySql.Data.EntityFrameworkCore.dll and Microsoft.AspNetCore.All (2.0.0-preview2-final). I changed librairy for MySql many times, but to no avail.
, ? ?