Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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:

  1. I created scripts for the necessary tables and added them to my own DB
  2. I added ADO.NET Entity Data Model (database first) which include my tables plus identity tables.
  3. I ran the application and registered for a user, everything is going fine.

Now, i need to add a relation to ASpNetUser table.

  1. I added the Column LocationId with the relationship in DB.
  2. I Added the following to the Application User Class:

 public virtual Region Region { get; set; }

  1. 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?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.