O.O
O.O

Reputation: 11317

Entity Framework - Entity not added to design surface

I attempted to update my edmx file by selecting a table. The tool spit out a info message that said the table did not have a primary key.

The entity did not get added to the design surface but it did get added to the .edmx file. In addition, using the model browser I see an Entities.Store and an Entities. My table got added to Entities.Store, but not to Entities.

I cannot access the table that was "added" in the code.

What do I do?

Steps to reproduce:

  1. Create a SQL table with two columns that are both defined as foreign keys to other tables. Make sure the tables that the FKs point to already exist in the model on the design surface.
  2. Right click and choose Update Model from Database...
  3. Next. Under the Add tab, mark the new table under Tables
  4. Click Finish.

An association will be created and it will be selected on the design surface, but it won't start with FK_, it will just be the name of your table. Go to the Model Browser and look under Entity Types. The table will not be there. Look under Associations and you will see your table name there as an association, but it will look out of place (because of the name).

Upvotes: 0

Views: 135

Answers (1)

O.O
O.O

Reputation: 11317

Entity Framework was too smart for me. It created an association instead of an entity. Odd, but it works for how I need to use it.

Upvotes: 1

Related Questions