Reputation: 2580
There are couple similar questions and answers are like: Better add a primary key...
The question is: Is it possible to insert data in table without primary key using entity framework?
Or I have to use SqlConnection
class?
Thank you
Upvotes: 1
Views: 2106
Reputation: 364279
No it is not possible with EF. EF demands that every table has a primary key. If it doesn't have a primary key you must somehow cheat EF so that it believes that some column is primary key - that requires manual modification of EDMX file.
Generally if you have table where no set of columns uniquely identifies records you should not use EF to work with such table because EF always demands unique identification. This is also true for database views.
Upvotes: 4