Exemplo n.º 1
0
        public static T Get <T>(object key, bool throwExceptionIfNotFind = false)
        {
            var res = Get(SingletonKey.GetKey <T>(key));

            if (res != null)
            {
                return((T)res);
            }
            if (throwExceptionIfNotFind)
            {
                throw new KeyNotFoundException("No se ha encontrado el objecto de tipo '" + typeof(T).Name + " con la clave '" + (key ?? "null") + "'.");
            }
            return(default(T));
        }
Exemplo n.º 2
0
 public static bool Contains <T>()
 {
     return(Contains <T>(SingletonKey.GetKey <T>()));
 }
Exemplo n.º 3
0
 public static bool Remove <T>(object key)
 {
     return(Remove <T>(SingletonKey.GetKey <T>(key)));
 }
Exemplo n.º 4
0
 public static bool Remove <T>()
 {
     return(Remove <T>(SingletonKey.GetKey <T>()));
 }
Exemplo n.º 5
0
 public static void Add <T>(T objectInstance, object key)
 {
     Add(objectInstance, SingletonKey.GetKey <T>(key));
 }
Exemplo n.º 6
0
 public static void Add <T>() where T : new()
 {
     Add(new T(), SingletonKey.GetKey <T>());
 }
Exemplo n.º 7
0
 public static void Subscribe <T>(Action <SingletonSubscriptionArgs <T> > changeAction, object key, bool raiseAddIfAlreadyAdded = true)
 {
     Subscribe <T>(changeAction, SingletonKey.GetKey <T>(key));
 }
Exemplo n.º 8
0
 public static bool Set <T>(T substitute, object key)
 {
     return(Set <T>(SingletonKey.GetKey <T>(key), substitute));
 }
Exemplo n.º 9
0
 public static bool Set <T>(T substitute)
 {
     return(Set <T>(SingletonKey.GetKey <T>(), substitute));
 }
Exemplo n.º 10
0
 public static bool Contains <T>(object key)
 {
     return(Contains <T>(SingletonKey.GetKey <T>(key)));
 }