I'm currently working on an older MVC 5 website that originally was using a code-first generated database with Entity Framework. It has since been converted to db-first, refactored, and I'm now in the process of removing the old entity c# files and replacing them with ADO.net's entity framework.
The problem I'm currently having is when logging in, I hit the following line in the ApplicationUserManager (which derives from UserManager(TUser, TKey)):
var user = await UserManager.FindByEmailAsync(model.Email);
And I get the following error: "The specified type member 'UserId' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
Our ApplicationUser entity which mirrors the db table uses the variable 'Id' instead of 'UserId.' I overrode the method in question and it worked but I don't want to do that whenever we need to use the UserManager. So I guess I'm confused, does UserManager require the variable be named, 'UserId?' If not, how can I tell it to use 'Id'?
I don't think I'm missing anything (like accidentally adding a 'UserId' in a LINQ statement somewhere).