protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{optionsBuilder.UseMySql(connectionString: @"server=localhost;userid=root;password=***;database=coursesystemdb");
}
This is the dbcontext class that ı had used optionsbuilder.usemysql and after upgrade my core to 5.0 and ı take error no overload for method usemsql takes 1 arguments. How can ı solve this?
here is also startup.class
public void ConfigureServices(IServiceCollection services)
{services.AddCors(options =>
{options.AddPolicy("AllowOrigin", builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
});
Thanks a lot
Take a look at the sample code on our front page/readme:
It shows you how to call
UseMySql()
and that it expects 2 parameters: the connection string and the version of the database server that you are using.You can also let the server version be detected automatically, instead of specifying it explicitly (showed using
OnConfiguring()
here, which you used in your OP):We added a mandatory
serverVersion
parameter to theUseMySql()
method in 5.0, because Pomelo supports MySQL and MariaDB in different versions and needs to know which one you use, so that it can support your database server in the best way possible.