Пример #1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            //CRL.SettingConfig.UseReadSeparation = true;
            CRL.Package.SettingConfig.OnlinePayOrderRefund = (order) =>
            {
            };
            CRL.SettingConfig.FieldParameName     = true;
            CRL.SettingConfig.ReplaceSqlParameter = true;
            //配置数据连接
            CRL.SettingConfig.GetDbAccess = (dbLocation) =>
            {
                var obj = dbLocation.TagData;
                return(Code.LocalSqlHelper.MysqlConnection);

                if (dbLocation.ShardingDataBase != null)//按分库判断
                {
                    if (dbLocation.ShardingDataBase.Name == "db1")
                    {
                        return(WebTest.Code.LocalSqlHelper.TestConnection);
                    }
                    else
                    {
                        return(WebTest.Code.LocalSqlHelper.TestConnection2);
                    }
                }
                else
                {
                    //可按type区分数据库
                    var type2 = dbLocation.ManageType;
                    if (type2 == typeof(Code.MongoDBTestManage))
                    {
                        return(Code.LocalSqlHelper.MongoDB);
                    }
                    if (dbLocation.DataAccessType == CRL.DataAccessType.Read)
                    {
                        return(Code.LocalSqlHelper.TestConnection2);
                    }
                    return(WebTest.Code.LocalSqlHelper.TestConnection);
                }
            };
            #region 缓存服务端实现
            //增加处理规则
            CRL.CacheServerSetting.AddCacheServerDealDataRule(typeof(Code.CacheDataTest), Code.CacheDataTestManage.Instance.DeaCacheCommand);
            //启动服务端
            var cacheServer = new CRL.CacheServer.TcpServer(11236);
            cacheServer.Start();
            #endregion

            //实现缓存客户端调用
            //有多个服务器添加多个
            //要使用缓存服务,需要设置ProductDataManage.QueryCacheFromRemote 为 true
            CRL.CacheServerSetting.AddTcpServerListen("127.0.0.1", 11236);
            //CRL.CacheServerSetting.AddTcpServerListen("122.114.91.203", 11236);
            CRL.CacheServerSetting.Init();

            //var listenTestServer = new CRL.ListenTestServer(1438);
            //listenTestServer.Start();
        }
Пример #2
0
        protected void Application_Start(object sender, EventArgs e)
        {
            CRL.Package.SettingConfig.OnlinePayOrderRefund = (order) =>
            {
            };
            //配置数据连接
            CRL.SettingConfig.GetDbAccess = (dbLocation) =>
            {
                if (dbLocation.ShardingDataBase != null)//按分库判断
                {
                    if (dbLocation.ShardingDataBase.Name == "db1")
                    {
                        return(WebTest.Code.LocalSqlHelper.TestConnection);
                    }
                    else
                    {
                        return(WebTest.Code.LocalSqlHelper.TestConnection2);
                    }
                }
                else
                {
                    //可按type区分数据库
                    var type2 = dbLocation.ManageType;
                    if (type2 == typeof(Code.MongoDBTestManage))
                    {
                        return(Code.LocalSqlHelper.MongoDB);
                    }
                    return(WebTest.Code.LocalSqlHelper.TestConnection);
                }
            };
            #region 缓存服务端实现
            //增加处理规则
            CRL.CacheServerSetting.AddCacheServerDealDataRule(typeof(Code.ProductData), Code.ProductDataManage.Instance.DeaCacheCommand);
            //启动服务端
            var cacheServer = new CRL.CacheServer.TcpServer(1136);
            cacheServer.Start();
            #endregion

            //实现缓存客户端调用
            //有多个服务器添加多个
            //要使用缓存服务,需要设置ProductDataManage.QueryCacheFromRemote 为 true
            CRL.CacheServerSetting.AddTcpServerListen("127.0.0.1", 1136);
            CRL.CacheServerSetting.Init();
        }
Пример #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            //配置数据连接
            CRL.SettingConfig.GetDbAccess = (type) =>
            {
                //可按type区分数据库
                return WebTest.Code.LocalSqlHelper.TestConnection;
            };
            #region 缓存服务端实现
            //增加处理规则
            CRL.CacheServerSetting.AddCacheServerDealDataRule(typeof(Code.ProductData), Code.ProductDataManage.Instance.DeaCacheCommand);
            //启动服务端
            var cacheServer = new CRL.CacheServer.TcpServer(1129);
            cacheServer.Start();
            #endregion

            //实现缓存客户端调用
            //有多个服务器添加多个
            CRL.CacheServerSetting.AddClientProxy("127.0.0.1", 1129);
            CRL.CacheServerSetting.Init();
        }
Пример #4
0
        protected void Application_Start(object sender, EventArgs e)
        {
            //配置数据连接
            CRL.SettingConfig.GetDbAccess = (type) =>
            {
                //可按type区分数据库
                return(WebTest.Code.LocalSqlHelper.TestConnection);
            };
            #region 缓存服务端实现
            //增加处理规则
            CRL.CacheServerSetting.AddCacheServerDealDataRule(typeof(Code.ProductData), Code.ProductDataManage.Instance.DeaCacheCommand);
            //启动服务端
            var cacheServer = new CRL.CacheServer.TcpServer(1129);
            cacheServer.Start();
            #endregion

            //实现缓存客户端调用
            //有多个服务器添加多个
            CRL.CacheServerSetting.AddClientProxy("127.0.0.1", 1129);
            CRL.CacheServerSetting.Init();
        }
Пример #5
0
        protected void Application_Start(object sender, EventArgs e)
        {
            CRL.Package.SettingConfig.OnlinePayOrderRefund = (order) =>
                {
                };
            //配置数据连接
            CRL.SettingConfig.GetDbAccess = (dbLocation) =>
            {
                
                if (dbLocation.ShardingDataBase != null)//按分库判断
                {
                    if (dbLocation.ShardingDataBase.Name == "db1")
                    {
                        return WebTest.Code.LocalSqlHelper.TestConnection;
                    }
                    else
                    {
                        return WebTest.Code.LocalSqlHelper.TestConnection2;
                    }
                }
                else
                {//可按type区分数据库
                    var type2 = dbLocation.ManageType;
                    return WebTest.Code.LocalSqlHelper.TestConnection;
                }
            };
            #region 缓存服务端实现
            //增加处理规则
            CRL.CacheServerSetting.AddCacheServerDealDataRule(typeof(Code.ProductData), Code.ProductDataManage.Instance.DeaCacheCommand);
            //启动服务端
            var cacheServer = new CRL.CacheServer.TcpServer(1129);
            cacheServer.Start();
            #endregion

            //实现缓存客户端调用
            //有多个服务器添加多个
            //要使用缓存服务,需要设置ProductDataManage.QueryCacheFromRemote 为 true
            CRL.CacheServerSetting.AddClientProxy("127.0.0.1", 1129);
            CRL.CacheServerSetting.Init();
        }