0

I want to retrieve entities using EF.

I then save them in enterprise_library_cache

I get sometimes an error "ObjectContext was disposed already"

I'm uging using at a very high leve - one per request, but I guess the entities are used after thier contextObject were disposed.

I think this will solve my problem:

How do I force eager loading from DB (including all forigen keys, meaning nested entities) +

detaching it from any context ?

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • Look, for example, at Include extension method :http://msdn.microsoft.com/en-us/library/gg679205%28v=vs.103%29.aspx . If your not in EF 5.0, the overload with an `Expression>` parameter also exists in System.Data.Entity, while overload with string parameter is (if I'm not wrong) in System.Linq. – Raphaël Althaus Feb 05 '13 at 13:20
  • I have entities with references to entities. Including any one of them is not that elegant – Elad Benda Feb 05 '13 at 13:38
  • what happens when I attach entity which is already attached? – Elad Benda Feb 05 '13 at 16:00

0 Answers0