Bug #78459 .NET EF Provider Miss Default DbConfiguration
Submitted: 16 Sep 2015 17:42 Modified: 17 Oct 2015 13:20
Reporter: pudding pudding Email Updates:
Status: No Feedback Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.9.7 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: DbConfiguration, entity framework, MiragationSqlGenerator

[16 Sep 2015 17:42] pudding pudding
when use code first model to create new db, an error will throw like:

Specified key was too long; max key length is 767 bytes

and there is no MiragationSqlGenerator regist in EF that will cause an error be throw when automatic miragation by code.

to void those issue, i must add some more code in static constractor of my DbContext like:

DbConfiguration.SetConfiguration(new MySql.Data.Entity.MySqlEFConfiguration());

the other db providers are not need to do that.

How to repeat:
1. use code first model to create db will throw an exception;
2. add some code in dbContext like this:

        static MyDbContext()
           Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDbContext, Configuration>());

   add a class like this:

    internal sealed class Configuration : DbMigrationsConfiguration<MyDbContext>
        public Configuration()
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
3. add a new property in model class which maps to table, programe will miragation db automatics. then an error will throw

Suggested fix:
do this in provider inside:

DbConfiguration.SetConfiguration(new MySql.Data.Entity.MySqlEFConfiguration());
[17 Sep 2015 13:20] Chiranjeevi Battula
Hello pudding,

Thank you for the bug report.
Could you please provide repeatable test case (exact create table statements, model, context class, etc.) to confirm this issue at our end?

[18 Oct 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".