private static bool AddCache(ListCacheEntidad <T> cache) { if (!_data.ContainsKey(cache.Nombre)) { _data.Add(cache.Nombre, cache); return(true); } return(false); }
public static ListCacheEntidad <T> ObtenerCache(string nombre, CondicionBase cond, List <T> lista) { // Si no se especifca nombre se toma el de la clase T. if (String.IsNullOrEmpty(nombre)) { nombre = typeof(T).Name; } ListCacheEntidad <T> r = CacheEntidades <T> .GetCache(nombre); if (r == null) { ListCacheEntidad <T> l = new ListCacheEntidad <T>(nombre, cond, lista); l.Cargar(); CacheEntidades <T> .AddCache(l); r = l; } return(r); }