curiouswebster
asked on
Question about disposing my Entity Model
I create my RDDBDataStore very very often and want to be certain I am disposing it correctly.
In this code, RDDB is the object created for me by the Entity Framework (4.0) with the RDDB.edmx file.
Is this code correct to dispose of it? I set a breakpoint on Dispose() but it never reach it. How can I test this? Is this correct?
Thanks,
newbieweb
In this code, RDDB is the object created for me by the Entity Framework (4.0) with the RDDB.edmx file.
Is this code correct to dispose of it? I set a breakpoint on Dispose() but it never reach it. How can I test this? Is this correct?
Thanks,
newbieweb
public RDDBDataStore()
{
rddbEntities = new RDDB();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
{
if (disposing)
{
rddbEntities.Dispose();
GC.SuppressFinalize(this);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER