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?
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.
You can try to Detach each entity in the context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With