Пример #1
0
 /// <summary>
 /// Gets resource from 2 level resource pool.
 /// </summary>
 /// <param name="container">Name of container resource pool</param>
 /// <param name="item">Name of the actual resource inside the container</param>
 /// <returns>The object requested</returns>
 public IDisposable Get(object container, object item)
 {
     if (_Pool.CheckResource(container))
     {
         ResourcePool containerPool = (ResourcePool)_Pool.GetResource(container);
         return(containerPool.GetResource(item));
     }
     else
     {
         return(null);
     }
 }
Пример #2
0
 /// <summary>
 /// Stores item in the 2 level resource pool
 /// </summary>
 /// <param name="container">Name of the container resource pool</param>
 /// <param name="item">Name of the item</param>
 /// <param name="resource">The resource to store</param>
 public void Set(object container, object item, IDisposable resource)
 {
     if (_Pool.CheckResource(container))
     {
         ResourcePool containerPool = (ResourcePool)_Pool.GetResource(container);
         containerPool.SetResource(item, resource);
     }
     else
     {
         ResourcePool containerPool = new ResourcePool();
         _Pool.SetResource(container, containerPool);
         containerPool.SetResource(item, resource);
     }
 }