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

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

Question

I am building an online form application using Visual Studio 2013 and a MySql database, however I am stuck at the "Membership and Role Management" step. I created the membership using a database first technique, and when I try to add a new user, I receive the following error message:

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 don't have a column named "Extent1.Discriminator" elsewhere in the database, thus I'm baffled as to why this frustrating mistake occurred. I would appreciate any advice or assistance. Many thanks

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

Accepted Answer

When entity framework creates the underlying sql statements, it uses the table alias Extent1. The problem indicates that EF is either improperly configured or incorrectly interprets the structure of your database.

You must examine the query that underlies it and figure out why EF uses a field that it is not supposed to. Most likely, a relationship between two tables has been put up wrongly.

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