|
namespace Navnath.IOC
{
public static class ObjectPoolManager
{
public static ObjectContext Context
{
get { return context ?? (context = new ObjectContext()); }
}
public static ObjectPool Pool
{
get
{
ObjectPool pool;
if (Context.ContainsKey(string.Empty))
pool = Context[string.Empty];
else
{
pool = new ObjectPool();
Context.Add(string.Empty, pool);
}
return pool;
}
}
internal static ObjectFactory ObjectFactory
{
get
{
if(objectFactory == null)
objectFactory = new ObjectFactory();
return objectFactory;
}
}
private static ObjectContext context = null;
private static ObjectFactory objectFactory = null;
public static void Clear()
{
context.Dispose();
objectFactory.Dispose();
context = null;
objectFactory = null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.