I've applied ASP.NET Core 3.1 in my project and I want to create database by code-first approach and use MySQL. In startup.cs file I got this error:
CS1061 'MySQLDbContextOptionsBuilder' does not contain a definition for 'ServerVersion' and no accessible extension method 'ServerVersion' accepting a first argument of type 'MySQLDbContextOptionsBuilder'
How can I solve it?
in startup.cs:
using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContextPool<Alpha.Web.App.ApplicationDbContext>(options =>
options.UseMySQL(Configuration["ConnectionStrings:DefaultConnection"],
mysqlOptions =>
{
mysqlOptions.ServerVersion(new Version(8, 0, 20), ServerType.MySql);
}));
}