Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework 4 with MySQL connector 6.4.3 autogenerate tables causes "Column Length" exception
    primarykey
    data
    text
    <p>I am working with MySQL and the .Net EntityFramework 4 using the Code First approach. The mysql connector version is 6.4.3. </p> <p>When I run the project for the first time my initializer attempts to "DropCreateDatabaseAlways". The database is created as well as all the tables. Then the following exception is thrown.</p> <p><pre><code>Column length too big for column 'ModelHash' (max = 21845); use BLOB or TEXT instead Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p> <p>Exception Details: MySql.Data.MySqlClient.MySqlException: Column length too big for column 'ModelHash' (max = 21845); use BLOB or TEXT instead</p> <p>Source Error:</p> <p>Line 38: public virtual List GetAll() Line 39: { Line 40: return dbSet.ToList(); Line 41: } Line 42: </p> <p>Source File: C:\Users\Andrew\Documents\Visual Studio 2010\Projects\SearchCore\OnlineID.DAL\GlobalGatewayRepository.cs Line: 40</p> <p>Stack Trace:</p> <p>[MySqlException (0x80004005): Column length too big for column 'ModelHash' (max = 21845); use BLOB or TEXT instead] MySql.Data.MySqlClient.MySqlStream.ReadPacket() +198 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32&amp; affectedRow, Int32&amp; insertedId) +73 MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32&amp; affectedRows, Int32&amp; insertedId) +20 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) +100 MySql.Data.MySqlClient.MySqlDataReader.NextResult() +836 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +1399 MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() +36 MySql.Data.MySqlClient.MySqlScript.Execute() +551 MySql.Data.MySqlClient.MySqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable<code>1 commandTimeout, StoreItemCollection storeItemCollection) +260 System.Data.Objects.ObjectContext.CreateDatabase() +84 System.Data.Entity.Internal.DatabaseOperations.CreateIfNotExists(ObjectContext objectContext) +28 System.Data.Entity.Database.CreateIfNotExists() +53 System.Data.Entity.DropCreateDatabaseAlways</code>1.InitializeDatabase(TContext context) +233 System.Data.Entity.&lt;>c__DisplayClass2<code>1.&lt;SetInitializerInternal&gt;b__0(DbContext c) +75 System.Data.Entity.Internal.&lt;&gt;c__DisplayClass5.&lt;PerformDatabaseInitialization&gt;b__3() +19 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +72 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +169 System.Data.Entity.Internal.LazyInternalContext.&lt;InitializeDatabase&gt;b__4(InternalContext c) +7 System.Data.Entity.Internal.RetryAction</code>1.PerformAction(TInput input) +118 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action<code>1 action) +190 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +27 System.Data.Entity.Internal.Linq.InternalSet</code>1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet<code>1.GetEnumerator() +15 System.Data.Entity.Infrastructure.DbQuery</code>1.System.Collections.Generic.IEnumerable.GetEnumerator() +40 System.Collections.Generic.List<code>1..ctor(IEnumerable</code>1 collection) +315 System.Linq.Enumerable.ToList(IEnumerable<code>1 source) +58 OnlineID.DAL.GlobalGatewayRepository</code>1.GetAll() in C:\Users\Andrew\Documents\Visual Studio 2010\Projects\SearchCore\OnlineID.DAL\GlobalGatewayRepository.cs:40 OnlineID.BAL.AccountService.GetAccounts() in C:\Users\Andrew\Documents\Visual Studio 2010\Projects\SearchCore\OnlineID.BAL\AccountService.cs:32 OnlineID.Website.Controllers.AccountManagement.AccountManagementController.Index() in C:\Users\Andrew\Documents\Visual Studio 2010\Projects\SearchCore\OnlineID.Website\Controllers\AccountManagement\AccountManagementController.cs:29 lambda_method(Closure , ControllerBase , Object[] ) +62 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary<code>2 parameters) +208 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary</code>2 parameters) +27 System.Web.Mvc.&lt;>c_<em>DisplayClass15.b</em>_12() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func<code>1 continuation) +263 System.Web.Mvc.&lt;&gt;c__DisplayClass17.&lt;InvokeActionMethodWithFilters&gt;b__14() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList</code>1 filters, ActionDescriptor actionDescriptor, IDictionary<code>2 parameters) +191 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore() +116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +37 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +21 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8</code>1.b__7(IAsyncResult <em>) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.&lt;>c</em>_DisplayClasse.b_<em>d() +50 System.Web.Mvc.SecurityUtil.b</em>_0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8920029 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +184 </pre></code></p> <p>I'm not sure what this "ModelHash" column is as it does not exist in my models.</p> <p>Thanks, AFrieze</p> <hr> <p>I have identified the location of this ModelHash column, it is in the EdmMetadata table that is used to track changes. The error I am experiencing can be eliminated by adding the following modelBuilder.Conventions.Remove(); Is there a way to use EdmMetadata with MySQL then?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload