Print Page | Close Window

Dispose of EntityManager

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2213
Printed Date: 22-May-2026 at 2:22pm


Topic: Dispose of EntityManager
Posted By: cjohnson84
Subject: Dispose of EntityManager
Date Posted: 04-Oct-2010 at 10:16am
What's the recommended way to completely dispose of an Entity Manager once you're finished with it?



Replies:
Posted By: sbelini
Date Posted: 07-Oct-2010 at 11:04am

An Entity Manager will be taken care of by the Garbage Collection once there are not references to it.

Yet, if you want to be extra cautious, you could do;
 
_entityManager.Clear();
_entityManager = null;
 
Be sure not to have any references to _entityManager (UI, etc).



Print Page | Close Window