Beispiel #1
0
 protected static T CreateProductInternal(string assemblyString, string typeName)
 {
     if (!FactoryBase <T> .ExistsProduct(typeName))
     {
         object product = System.Reflection.Assembly.Load(assemblyString).CreateInstance(typeName);
         FactoryBase <T> .AddProduct(typeName, product);
     }
     return(FactoryBase <T> ._cachedInstances[typeName] as T);
 }
Beispiel #2
0
 protected static void AddProduct(string typeName, object instance)
 {
     if (string.IsNullOrWhiteSpace(typeName) || instance == null)
     {
         return;
     }
     if (FactoryBase <T> .ExistsProduct(typeName))
     {
         return;
     }
     FactoryBase <T> ._cachedInstances.Add(typeName, instance);
 }