Cae*_*sar 1 mysql asp.net membership-provider entity-framework-6 asp.net-identity
我正在使用 Visual Studio 2013 Web 表单应用程序和 MySql 数据库来构建 Web 表单应用程序,但我无法通过“成员资格和角色管理”。我对会员资格使用了数据库优先方法,当我尝试注册新用户时,收到以下错误消息:
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.
Exception Details: MySql.Data.MySqlClient.MySqlException: Unknown column 'Extent1.Discriminator' in 'where clause'
Source Error:
Line 16: var manager = new UserManager();
Line 17: var user = new ApplicationUser() { UserName = UserName.Text };
Line 18: IdentityResult result = manager.Create(user, Password.Text);
Line 19: if (result.Succeeded)
Line 20: {
Source File: c:\WebsiteProjects\ASPNETWebProjects\RevenuePortal\RevenuePortal\Account\Register.aspx.cs
Run Code Online (Sandbox Code Playgroud)
奇怪的是,我在数据库中的任何地方都没有“Extent1.Discriminator”列,并且无法理解这个令人沮丧的错误的原因。
Extent1是实体框架构造底层sql语句时使用的表别名。该错误意味着 EF 未正确配置或错误解释了您的数据库结构。
您需要分析它生成的基础查询并确定为什么 EF 使用了不应该使用的字段。可能两个表之间的关系设置不正确。