How can I get rid of the object context?

entity-framework

Question

If I ran several queries and ObjectContext was populated with entities how do I clear the context if I don't need those entities anymore. I know that I need to dispose the context as soon as possible, but in this case it is not possible. So is there any way that I can remove those objects from the context?

1
4
9/29/2010 11:06:58 PM

Accepted Answer

You can try to Detach each entity in the context.

1
9/30/2010 12:03:21 PM

Popular Answer

There is no method for "clearing" ObjectContext. The only way to do that is to Dispose current instance of ObjectContext and start the new instance.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow