예제 #1
0
        public static IBizFactory BuilderBizFactory()
        {
            IBizFactory factory    = null;
            string      typeString = ConfigurationManager.AppSettings["BizFactoryType"];

            if (string.IsNullOrEmpty(typeString))
            {
                throw new ConfigurationErrorsException("BizFactoryType 未配置");
            }
            lock (dict)
            {
                if (dict.ContainsKey(typeString))
                {
                    factory = dict[typeString];
                }
                else
                {
                    Type   type = Type.GetType(typeString, true);
                    object obj  = Activator.CreateInstance(type);
                    if (obj is IBizFactory)
                    {
                        factory = obj as IBizFactory;
                        dict.Add(typeString, factory);
                    }
                }
            }
            return(factory);
        }
예제 #2
0
    public BaseAdapter()
    {
        IBizFactory factory = BizFactoryBuilder.BuilderBizFactory();

        _manager = (T)(factory.CreateInstance(typeof(T)));

        _dataSetCache = new TypeCacheManager <DataSet>();
    }