Unknown column 'Extent1.Discriminator' in 'where clause'

asp.net asp.net-identity entity-framework-6 membership-provider mysql

Question

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  

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

1
1
10/4/2015 9:43:45 PM

Accepted Answer

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.

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.

3
10/4/2015 10:24:24 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow