This code is in tge DatabaseDbProvider.cs ContextFactory and in the DbSetExtensions class
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseMySql("Server=localhost;Port=3306;Database=beyond_migrator;User=maria_service;", mysqlOptions =>
{
mysqlOptions.ServerVersion(new Version(10, 3, 9), ServerType.MariaDb)
.CharSet(CharSet.Utf8Mb4)
.CharSetBehavior(CharSetBehavior.AppendToAllColumns);**
});
base.OnConfiguring(optionsBuilder);
}
MySqlDbContextOptionsBuilder does not contain the definition for ServerVersion
i see ways to solve the version 'MySQLDbContextOptionsBuilder' does not contain a definition for 'ServerVersion'
but Charset and CharSetBehavior give the error.. CharSet() is obsolete. Call the Fluent API extension method HasCharSet() on the builder object of you model/entities/properties instead. To get the exact behavio as with CharSet() call modelBuilder.HasCharSet(charSet, DelgationModes.ApplyToColums.
How exactly can i access the builder object for the entire model. This code above is only on connection. Did the developer not need to specifiy these in the connection in the first place?
The only place where ModelBuilder is accessable is in OnModelCreating in the DbContext file, or in migration files.
P.S. this all became an issue, when being tasked to upgrade a 3.1 entity framework project to a EF 7. Here is the reference to the other open question upgraded .net Entity Framework using MySql and Pomelo Entity Framework Core (3.1 5.0 6.0 7.0 ) using code first
is it safe to just do this?
and not worry about setting the CharSet and CharSetBehavior on connection?