示例#1
0
 public override ICacheProvider Create(string typeName)
 {
     if (string.IsNullOrWhiteSpace(typeName) || typeName.Length <= 1 || !base.IsValidTypeName(typeName))
     {
         throw new System.ArgumentException("The type is invalid!");
     }
     return(FactoryBase <ICacheProvider> .CreateProductInternal(this.AssemblyString, string.Format("{0}.{1}Provider", this.AssemblyString, typeName)));
 }
示例#2
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);
 }
示例#3
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);
 }
示例#4
0
        public override ICacheProvider CreateDefault()
        {
            string typeName = this.DefaultTypeName;

            return(FactoryBase <ICacheProvider> .CreateProductInternal(this.AssemblyString, string.Format("{0}.{1}Provider", this.AssemblyString, typeName)));
        }