使用最新版本的EF6.2.1升级VS2013 MVC项目导致MySQL EF6抛出a您的SQL语法出错;错误

时间:2015-01-21 22:09:44

标签: mysql entity-framework upgrade

我的VS2013项目上安装了Entity Framework 6,身份2.0工作正常,当我使用Nuget升级EF6版本,并尝试使用本地MySQL数据库登录网站时,我收到此失败消息,没有其他更改在我的结尾。只升级并运行项目,我有一个项目的副本,并检查了所有的类,模型,AppStart,没有任何变化,所以我无法确定升级版本修改了什么。

为了澄清升级,在升级EF6之前,我升级了所有其他已安装的软件包,并且能够毫无错误地登录到网站,升级的唯一内容是EF6,一旦我这样做,我的项目就失败了。

我还检查了是否有任何影响访问其他数据,使用linq查询我能够从MySQL数据库中的其他表中检索数据并显示在我的视图上,我唯一的问题是当我尝试登录时网站。

第75行:var result = await SignInManager.PasswordSignInAsync(model.UserName,model.Password,model.RememberMe,shouldLockout:false); 第76行:开关(结果) 第77行:{

堆栈追踪:

[MySqlException(0x80004005):您的SQL语法有错误;查看与MySQL服务器版本对应的手册,以便在' FROM附近使用正确的语法((SELECT 情况(Extent2UserId是空)然后(空)ELSE(1)结束'在第28行]    MySql.Data.MySqlClient.MySqlStream.ReadPacket()+383    MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow,Int64& insertedId)+116    MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId,Int32& affectedRows,Int64& insertedId)+54    MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId,Boolean force)+145    MySql.Data.MySqlClient.MySqlDataReader.NextResult()+1258    MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)+2484    MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)+58    System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior,CancellationToken cancellationToken)+176    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() +24 System.Data.Entity.Utilities.CultureAwaiter 1.GetResult()+123    System.Data.Entity.Core.EntityClient.Internal.d__c.MoveNext()+ 447

[EntityCommandExecutionException:执行命令定义时发生错误。有关详细信息,请参阅内部异常。]    System.Data.Entity.Core.EntityClient.Internal.d__c.MoveNext()+549    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() +24 System.Data.Entity.Utilities.CultureAwaiter 1.GetResult()+123    System.Data.Entity.Core.Objects.Internal.d__0 1.MoveNext() +2429 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 System.Runtime.CompilerServices.TaskAwaiter 1.GetResult()+24    System.Data.Entity.Utilities.CultureAwaiter 1.GetResult() +123 System.Data.Entity.Core.Objects.<ExecuteInTransactionAsync>d__3d 1.MoveNext()+ 1521    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() +24 System.Data.Entity.Utilities.CultureAwaiter 1.GetResult()+123    System.Data.Entity.Core.Objects.d__e.MoveNext()+1075    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() +24 System.Data.Entity.Utilities.CultureAwaiter 1.GetResult()+123    System.Data.Entity.Internal.d__0.MoveNext()+538    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() +24 System.Data.Entity.Utilities.CultureAwaiter 1.GetResult()+66    System.Data.Entity.Infrastructure.d__25 1.MoveNext() +463 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 System.Runtime.CompilerServices.TaskAwaiter 1.GetResult()+24    Microsoft.AspNet.Identity.CultureAwaiter 1.GetResult() +123 Microsoft.AspNet.Identity.Owin.<PasswordSignInAsync>d__29.MoveNext() +661 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 System.Runtime.CompilerServices.TaskAwaiter 1.GetResult()+24    ZA2.UI.Controllers.d__2.MoveNext()在c:\ DOCUMENTS \ Visual Studio 2013 \ Projects \ ZA2(mySQL Identity 2.0)\ ZA2 \ ZA2.UI \ Controllers \ AccountController.cs:75    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+93    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()+ 21    System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(任务任务)+61    System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)+114    System.Web.Mvc.Async。&lt;&gt; c__DisplayClass37.b__36(IAsyncResult asyncResult)+66    System.Web.Mvc.Async.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+136    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+102    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)+49    System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d()+117    System.Web.Mvc.Async。&lt;&gt; c__DisplayClass46.b__3f()+323    System.Web.Mvc.Async。&lt;&gt; c__DisplayClass33.b__32(IAsyncResult asyncResult)+44    System.Web.Mvc.Async.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+136    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+102    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)+50    System.Web.Mvc.Async。&lt;&gt; c__DisplayClass2b.b__1c()+72    System.Web.Mvc.Async。&lt;&gt; c__DisplayClass21.b__1e(IAsyncResult asyncResult)+185    System.Web.Mvc.Async.WrappedAsyncResult 1.CallEndDelegate(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+133    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+56    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)+40    System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult,ExecuteCoreState innerState)+34    System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+40    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+44    System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult,Controller controller)+39    System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) +62 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+40    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)+39    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)+39    System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult,ProcessRequestState innerState)+39    System.Web.Mvc.Async.WrappedAsyncVoid 1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase 1.End()+139    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+59    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,Object tag)+40    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+40    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)+38    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+9514928    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+155

1 个答案:

答案 0 :(得分:0)

将项目升级到EntityFramework 6.1.2后,您会从MySQL收到此错误。 EntityFramework 6.1.2没有生成使用多个Include方法的MySQL Linq查询执行的正确SQL语句。您可以在https://entityframework.codeplex.com/workitem/2673

查看错误详情

从EntityFramework 6.1.2降级到EntityFramework 6.1.1将解决您的问题。

以下是从EF 6.1.2降级到EF 6.1.1所需的步骤:

在VS 2013中打开包管理器并执行以下命令:

  

Update-Package EntityFramework -Version 6.1.1

作为替代测试解决方案,您可以从左侧的下载按钮下载EntityFramework 6.1.1 nuget package http://pierandev.com/feeds/Default/EntityFramework/6.1.1?redirectIfNotFound=n,并使用7-zip或替代zip提取器打开下载的文件,然后替换您现有的EntityFramework 6.1.2使用EntityFramework 6.1.1 dll从nuget包文件中提取dll。