c# - Specified key was too long; max key length is 767 bytes Mysql error in Entity Framework 6 -


I started working on the Asp.net MVC-5 application using Visual Studio 2012. So I downloaded the ATI Framework-6 and MySQL 6.8.3.0 from Newslett when I tried to create a database using the DB reference command

  dbContext.Database.CreateIfNotExists ();  

This exception was thrown.

The specified key was too long; The maximum key length is 767 bytes

I searched on this, but no solution can be found. Whatever I have found during my search, this can be a Unicode character problem. I do not know the way to deal with this problem.

Renew

I am using the following configuration

  & lt; Configuration & gt; & Lt; ConfigSections & gt; & Lt; Section Name = "Antenna Framework" type = "System.Data.in.te.INNAL.confifffile.EntitieFileWriter Description, Entity Framework, Version = 6.0.0.0, Culture = Neutral, Public Key Token = B77A5C 561934A090" Requirements = "False" /> & Lt; / ConfigSections & gt; & Lt; EntityFramework & gt; & Lt; Providers & gt; & Lt; Provider invariantName = "MySql.Data.MySqlClient" type = "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> & Lt; / Providers & gt; & Lt; / EntityFramework & gt; & Lt; System.data & gt; & Lt; DbProviderFactories & gt; & Lt; Remove invariant = "MySql.Data.MySqlClient" /> & Lt; add name = "MySQL Data Provider" invariant = "MySql.Data.MySqlClient" Description = ".Net Framework data provider for MySQL" type = "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version = 6.8.3.0, Culture = Neutral, public token = c5687fc88969c44d "/> & Lt; / DbProviderFactories & gt; & Lt; /system.data> & Lt; / Configuration & gt;  

My DB reference class. I have left only one model for all models

  Public category MyContext: DbContext {Public MyContext (): Base ("myconn") {this.Configuration.ValidateOnSaveEnabled = false; } Safe Override Zero OnModelCreating (DbModelBuilder Model Builder) {modelBuilder.Conventions.Remove & lt; System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention & gt; (); Base.OnModelCreating (modelBuilder); } Public DbSet & lt; ModelOne & gt; ModelOne {Receive; Set; }}  

Model class

  public class ModelOne {[Key] public int created id {get; Set; } Public taps qualified & lt; Int & gt; UserId {get; Set; } Public taps qualified & lt; DateTime & gt; Date {Received; Set; } Public string description {get; Set; }}  

Can anyone help me with this issue?

Thank you.

I changed the DbConfigurationType DbContext.

got this from this link

Now it is working

  [DBconfigation type (typef (MySQL.data.inte.myskifyfiferation)) ] Public class Mycotex: DBcinTex {public micotext (): base ("McNon") {this.configuration.ValidateOnSaveEnabled = false; } Fixed MyContext () {DbConfiguration.SetConfiguration (New MySql.Data.Entity.MySqlEFCconfiguration ()); } Safe Override Zero OnModelCreating (DbModelBuilder Model Builder) {modelBuilder.Conventions.Remove & lt; System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention & gt; (); Base.OnModelCreating (modelBuilder); } Public DbSet & lt; ModelOne & gt; ModelOne {Receive; Set; }}  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -