Is it possible Entity framework will support table without primary key?
-
Monday, March 18, 2013 5:52 AM
Hi All,
I have tables without primary key in my project.when I using entity framework for this table it is showing below error.
"
Warning 2 Error 6013: The table/view does not have a primary key defined and no valid primary
key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the
correct keys, and uncomment it. "
Also I have one limitation that I can not add a new primary key column to that table.
Is it possible Entity framework will support table without primary key?Is there any other way how to solve this problem?
Could you please advise me how can we rectify this problem?
Thanks and regards,
Gopi
All Replies
-
Monday, March 18, 2013 3:52 PM
Hi,
If you have a table without PK, maybe you could read data from this table, but you'll can't update data using Entity Framework. It would be more or less as a view.
Maybe you can add an auto-increment or Guid without any meaning in your table, just to get a PK field.
Regards,
JA Reyes.
Please remember to Vote & "Mark As Answer" if this post is helpful to you.
Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil. -
Monday, March 18, 2013 3:55 PM
Anayway,
Take a look at this other thread:
http://stackoverflow.com/questions/3996782/entity-framework-table-without-primary-keyPlease remember to Vote & "Mark As Answer" if this post is helpful to you.
Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Thursday, April 04, 2013 9:28 AM

