KentZhou
KentZhou

Reputation: 25573

how to dispose DomainContext?

DomainContext consumes many memory when an instance created. If the instance is local variable, looks like the memory not released automatically with following code:

MyDomainContext  ctx = new MyDomainContext();
....
ctx=null;

How to release a memory for the instance of a DomainContext?

Upvotes: 0

Views: 318

Answers (1)

mCasamento
mCasamento

Reputation: 1433

DomainContext doesn't implements IDisposable so you must rely on GarbageCollector to free up your memory. Be sure to remove any reference to the DomainContext instance than call System.GC.Collect()
You shouldn't bother about the entities loaded by the domaincontext and still referenced somewhere in the code, as long as I know WCF Ria services keep only a WeakReference to them

Upvotes: 1

Related Questions