gpt4 book ai didi

mysql - 'Extent1.Discriminator' 中的未知列 'where clause'

转载 作者:行者123 更新时间:2023-11-29 05:15:54 24 4
gpt4 key购买 nike

我正在使用带有 MySql 数据库的 Visual Studio 2013 Web 表单应用程序来构建 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

奇怪的是,我在数据库中的任何地方都没有“Extent1.Discriminator”列,无法理解这个令人沮丧的错误的原因。

最佳答案

Extent1是 Entity Framework 在构造底层sql语句时使用的表别名。该错误意味着 EF 未正确配置或误解了您的数据库结构。

您需要分析它生成的基础查询并确定为什么 EF 使用了它不应该使用的字段。可能 2 个表之间的关系设置不正确。

关于mysql - 'Extent1.Discriminator' 中的未知列 'where clause',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32938736/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com