Exemplo n.º 1
0
        public void Getsqlconn(Domain.Entities.Connection con)
        {
            var sql = kvclient.GetStringKey <SqlConfiguration>("Conn:sql:" + con.Name);

            if (sql == null)
            {
                throw new Exception("未找到对应连接");
            }
            AppConfigurationConsts.SqlSugarConfiguration(new AbpSqlSugarConfiguration {
                ConnectionString = sql.Connectionstring,
                DbType           = sql.Engine
            });
        }
Exemplo n.º 2
0
        public void GetRedisConn(Domain.Entities.Connection con)
        {
            var redis = kvclient.GetStringKey <RedisConfiguration>("Conn:redis:" + con.Name);

            if (redis == null)
            {
                throw new Exception("未找到对应连接");
            }
            AppConfigurationConsts.RedisConfiguration(new AbpRedisConfiguration
            {
                ConnectionString = redis.Connectionstring,
                DatabaseId       = redis.DatabaseId
            });
        }
Exemplo n.º 3
0
        public void GetMongoConn(Domain.Entities.Connection con)
        {
            var mongo = kvclient.GetStringKey <MongoConfiguration>("Conn:Mongo:" + con.Name);

            if (mongo == null)
            {
                throw new Exception("未找到对应连接");
            }
            AppConfigurationConsts.MongoConfiguration(new AbpMongoDbConfiguration
            {
                ConnectionString = mongo.Connectionstring,
                DatatabaseName   = mongo.DatatabaseName,
            });
        }
Exemplo n.º 4
0
        public void GetEmailConn(Domain.Entities.Connection con)
        {
            var email = kvclient.GetStringKey <EmailConfiguration>("Conn:email:" + con.Name);

            if (email == null)
            {
                throw new Exception("未找到对应连接");
            }
            AppConfigurationConsts.EmailConfiguration(new AbpEmailConfiguration {
                Host     = email.Host,
                Port     = email.Port,
                UserName = email.UserName,
                Password = email.Password,
            });
        }
Exemplo n.º 5
0
        public override void PreInitialize()
        {
            //使用hangfire
            Configuration.BackgroundJobs.UseHangfire();

            //设置所有缓存的默认过期时间
            Configuration.Caching.ConfigureAll(cache =>
            {
                cache.DefaultAbsoluteExpireTime = TimeSpan.FromMinutes(2);
            });
            //设置某个缓存的默认过期时间 根据 "CacheName" 来区分
            Configuration.Caching.Configure("CacheName", cache =>
            {
                cache.DefaultAbsoluteExpireTime = TimeSpan.FromMinutes(2);
            });
            //使用redis数据库缓存
            Configuration.Caching.UseRedis(option =>
            {
                option.ConnectionString = _appConfiguration["Abp:RedisCache:ConnectionStrings"];
                option.DatabaseId       = int.Parse(_appConfiguration["Abp:RedisCache:DatabaseId"]);
            });
            AppConfigurationConsts.EmailConfiguration();
        }
Exemplo n.º 6
0
 public ConnectionManage()
 {
     _kvclient = RedisClientFactory.CreateRepository(AppConfigurationConsts.RedisConnectionString());
 }