Exemple #1
0
 private object CreateInstance(InjectInfo info)
 {
     if (info.InjectType == InjectType.Singleton)
     {
         if (info.instance == null)
         {
             if (info.CreateFunction != null)
             {
                 info.instance = info.CreateFunction();
             }
             else
             {
                 info.instance = CreateInstance(info.To);
             }
         }
         return(info.instance);
     }
     return(CreateInstance(info.To));
 }
Exemple #2
0
 private bool CheckEqual(InjectInfo info, Type t, string token)
 {
     if (string.IsNullOrEmpty(token))
     {
         if (info.From == t)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     if (info.From == t && info.Token == token)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }