예제 #1
0
파일: BMAData.cs 프로젝트: kfeynn/MyTiptop
        private static IRDBSStrategy _irdbsstrategy = null;//关系型数据库策略

        static BMAData()
        {
            try
            {
                //反射 找到 实现类 RDBSStrategy.*
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "MyTiptop.RDBSStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _irdbsstrategy = (IRDBSStrategy)Activator.CreateInstance(Type.GetType(string.Format("MyTiptop.RDBSStrategy.{0}.RDBSStrategy, MyTiptop.RDBSStrategy.{0}", fileNameList[0].Substring(fileNameList[0].LastIndexOf("RDBSStrategy.") + 13).Replace(".dll", "")), false, true));
            }
            catch
            {
                throw new Exception("创建'关系数据库策略对象'失败,可能存在的原因:未将'关系数据库策略程序集'添加到bin目录中;'关系数据库策略程序集'文件名不符合'MyTiptop.RDBSStrategy.{策略名称}.dll'格式");
            }
        }
예제 #2
0
        private static IOrderNOSQLStrategy _iordernosqlstrategy         = null; //订单非关系型数据库策略

        static BSPData()
        {
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BrnShop.RDBSStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _irdbsstrategy = (IRDBSStrategy)Activator.CreateInstance(Type.GetType(string.Format("BrnShop.RDBSStrategy.{0}.RDBSStrategy, BrnShop.RDBSStrategy.{0}", fileNameList[0].Substring(fileNameList[0].LastIndexOf("RDBSStrategy.") + 13).Replace(".dll", "")),
                                                                                      false,
                                                                                      true));
            }
            catch
            {
                throw new BSPException("创建'关系数据库策略对象'失败,可能存在的原因:未将'关系数据库策略程序集'添加到bin目录中;'关系数据库策略程序集'文件名不符合'BrnShop.RDBSStrategy.{策略名称}.dll'格式");
            }
            _enablednosql = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BrnShop.NOSQLStrategy.*.dll", SearchOption.TopDirectoryOnly).Length > 0;
        }
예제 #3
0
파일: BMAData.cs 프로젝트: qq550723504/zone
        private static IOrderNOSQLStrategy _iordernosqlstrategy = null;//订单非关系型数据库策略

        static BMAData()
        {
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BrnMall.RDBSStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _irdbsstrategy = (IRDBSStrategy)Activator.CreateInstance(Type.GetType(string.Format("BrnMall.RDBSStrategy.{0}.RDBSStrategy, BrnMall.RDBSStrategy.{0}", fileNameList[0].Substring(fileNameList[0].LastIndexOf("RDBSStrategy.") + 13).Replace(".dll", "")),
                                                                                            false,
                                                                                            true));
            }
            catch
            {
                throw new BMAException("创建'关系数据库策略对象'失败,可能存在的原因:未将'关系数据库策略程序集'添加到bin目录中;'关系数据库策略程序集'文件名不符合'BrnMall.RDBSStrategy.{策略名称}.dll'格式");
            }
            _enablednosql = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BrnMall.NOSQLStrategy.*.dll", SearchOption.TopDirectoryOnly).Length > 0;
        }
예제 #4
0
        private static bool _enablednosql = false;        //是否启用非关系型数据库


        static BSData()
        {
            _enablednosql = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BonSite.NOSQLStrategy.*.dll", SearchOption.TopDirectoryOnly).Length > 0;
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "BonSite.RDBSStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _rdbs = (IRDBSStrategy)Activator.CreateInstance(Type.GetType(string.Format("BonSite.RDBSStrategy.{0}.RDBSStrategy, BonSite.RDBSStrategy.{0}", fileNameList[0].Substring(fileNameList[0].LastIndexOf("RDBSStrategy.") + 13).Replace(".dll", "")),
                                                                             false,
                                                                             true));
            }
            catch


            {
                throw new BSException("创建\"关系数据库策略对象\"失败,可能存在的原因:未将\"关系数据库策略程序集\"添加到bin目录中;将多个\"关系数据库策略程序集\"添加到bin目录中;\"关系数据库策略程序集\"文件名不符合\"BonSite.RDBSStrategy.{策略名称}.dll\"格式");
            }
        }
예제 #5
0
        private static bool _enablednosql = false;          //是否启用非关系型数据库

        static HaData()
        {
            _irdbsstrategy = new RDBSStrategy();
            _enablednosql  = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "Halfox.NOSQLStrategy.*.dll", SearchOption.TopDirectoryOnly).Length > 0;
        }