0

In older EF versions I used to be able to see the entity key by using EntityObject.EntityKey

Obviously EF5 uses normal Objects and the only way I can see to get at the underlying entity framework object it to use DbContext.Entry(). This however still does not seem to give me access to the EntityKey.

Is there a way to get at this now?

coolblue2000
  • 3,796
  • 10
  • 41
  • 62
  • I think your answer is here http://stackoverflow.com/a/7253992/2300730 – Jurica Smircic May 11 '13 at 20:48
  • That looks incredibly inefficient! Is there no other way to find the key? I have a great extension method to reattach entites in EF4 but it seems this is almost impossible in ef5! Why on earth have they broken it? – coolblue2000 May 11 '13 at 20:55
  • `EntityKey` "doesn't exist" in POCO world. If you are going with POCOs you should not rely on `EntityKey`. They didn't break anything. The old way is still working but you must not use POCOs. – Ladislav Mrnka May 11 '13 at 21:01
  • I am not using POCOs. I am using Entity Framework created objects, these are now plain objects that it generates in ef5 while in ef4 it generated EntityObjects. So yes they have broken the old functionality as in EF4 the generated objects had an EntityKey property while in EF5 the generated objects do not. – coolblue2000 May 11 '13 at 21:15

0 Answers0