Exemplo n.º 1
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.º 2
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();
        }