1

I attached an .mdf file in SQL Server 2008 and used that database for my entity framework database first project. Below is the error I got

Exception Details: System.Data.MappingException: Schema specified is not valid.
Error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer"

I tried this link: How do I correctly set an association between two objects in the Entity Framework 4 Entitydesigner?

but it did not work for me. can anyone help me what can be the problem.

thanks, michaeld

Community
  • 1
  • 1
michaeld
  • 569
  • 1
  • 6
  • 10

1 Answers1

0

This exception usually occures if you have an entity in your model which doesn't mapped to a table (or an object) into the Database.

If you want that your project just starts debugging, Remove all entities from your model, Right-click in model designer and choose Update model from database

If you have an entity which it supposed to be mapped to a table into database, you should create a relative table in database, and map your entity to that table. You also can ghange your approach from db-first to code-first and enable migrations so that EF updates your db according to your model.

If you have an entity and you want to map it to a stored procedure in your db, see here

Amin Saqi
  • 18,549
  • 7
  • 50
  • 70