1

我正在使用Visual Studio 2013 Web表單應用程序和MySql數據庫來構建Web表單應用程序,但我一直無法通過'成員和角色管理'。 我用會員數據庫第一種方法,當我嘗試註冊一個新用戶,我得到以下錯誤信息:'where子句'中的未知列'Extent1.Discriminator'

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」列中的任意位置數據庫無法理解這個令人沮喪的錯誤的原因。我會感謝幫助或建議。謝謝

回答

2

Extent1是實體框架在構造基礎sql語句時使用的表別名。該錯誤意味着EF配置不正確或錯誤地解釋了您的數據庫結構。

您需要分析它生成的基礎查詢,並確定爲什麼EF us3是一個它不應該使用的字段。可能兩個表格之間的關係錯誤地設置。

+0

謝謝陰影。我允許ASP.net生成解決問題的數據庫表 – Caesar

+0

可能的錯誤包括缺失或錯誤的列/屬性。 – brichins