I am trying to use ASP.NET Identity 2.0 with existing database. I have created an MVC project (which uses Individual Account Authentication), then I registered for a use in order to create the DB.
Then:
- I created scripts for the necessary tables and added them to my own DB
- I added ADO.NET Entity Data Model (database first) which include my tables plus identity tables.
- I ran the application and registered for a user, everything is going fine.
Now, I need to add a relation to AspNetUser
table.
- I added the Column LocationId with the relationship in DB.
I Added the following to the Application User Class:
public virtual Region Region { get; set; }
Then, I updated my Model and run the application, when I tried to register for new user, I got the following error:
AspNet UserLogin: EntityType: EntitySet 'AspNetUserLogins' is based on type 'AspNet UserLogin' that has no keys defined.
How is it possible to continue using DB First Approach in this scenario?