hotcoder
hotcoder

Reputation: 3256

Can't add tables in Entity Model without Primary key

I have a problem in using Entity data model. I'm unable to add a table in entity model that has no primary key. The same situation is with the table that has composite key.

Upvotes: 2

Views: 4777

Answers (2)

Pratap
Pratap

Reputation: 183

1.Change the Table structure and add a Primary Column. Update the Model.

2.Modify the .EDMX file in XML Editor and try adding a New Column under tag for this specific table. (WILL NOT WORK)

3.Instead of creating a new Primary Column to Exiting table, i will make a composite key by involving all the existing columns.(WORKED)

Entity Framework: Adding DataTable with no Primary Key to Entity Model.

Upvotes: 0

Jahan Zinedine
Jahan Zinedine

Reputation: 14874

For composite keys sure you are wrong but for the first one How could a framework like Entity Framework could know which row has been updated, deleted while it can not identify the row by a primary key,

even in that tables you can have exact duplicate rows.

For the first one check this question

Upvotes: 3

Related Questions