'where子句'中的未知列'Extent1.Discriminator' [英] Unknown column 'Extent1.Discriminator' in 'where clause'

查看:1504
本文介绍了'where子句'中的未知列'Extent1.Discriminator'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2013 Web表单应用程序与MySql数据库来构建一个Web窗体应用程序,但我无法通过成员资格和角色管理。
我使用数据库的第一个方法为会员资格,当我尝试注册一个新用户时,我收到以下错误消息:

I am using Visual Studio 2013 web form application with MySql database to build a web form application but I have been unable to get passed 'Membership and Role Management'. I used a database first approach for the membership and when I try registering a new user, I get the error message below:

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  

奇怪的是,我没有一个Extent1.Discriminator列在数据库并不能理解这个令人沮丧的错误的原因。我会欣赏帮助或建议。谢谢

Strangely I do not have an 'Extent1.Discriminator' column anywhere in the database and cannot understand the reason for this frustrating error. I will appreciate help or suggestions. Thank you

推荐答案

Extent1是实体框架构建底层sql语句时使用的表别名。错误意味着EF未正确配置或误解您的数据库结构。

Extent1 is a table alias used by entity framework when it constructs the underlying sql statements. The error means that EF is either not configured correctly or misinterprets your database structure.

您需要分析其生成的底层查询,并确定EF us3为何不是字段应该是可能两个表之间的关系设置不正确。

You need to analyise the underlying query it generates and determine why EF us3s a field it is not supposed to. Probably a relationship between 2 tables is incorrectly set up.

这篇关于'where子句'中的未知列'Extent1.Discriminator'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆