예제 #1
0
        public async Task <ActionResult> DoAsync(SignInInfo model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.InvalidModelState(this.ModelState));
            }

            try
            {
                bool isValid = await this.CheckPasswordAsync(this.Tenant, model.Email, model.Password).ConfigureAwait(false);

                if (!isValid)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
                }

                var result = await DAL.SignIn.DoAsync(this.Tenant, model.Email, model.OfficeId, this.RemoteUser.Browser, this.RemoteUser.IpAddress, model.Culture.Or("en-US")).ConfigureAwait(false);

                string key     = "access_tokens_" + this.Tenant;
                var    factory = new DefaultCacheFactory();
                factory.Remove(key);

                return(await this.OnAuthenticatedAsync(result, model).ConfigureAwait(true));
            }
            catch (DbException ex)
            {
                Log.Information(ex.Message);
                return(this.AccessDenied());
            }
        }
예제 #2
0
파일: AppUsers.cs 프로젝트: frapid/frapid
        public static async Task<LoginView> SetCurrentLoginAsync(string tenant, long loginId)
        {
            if(loginId <= 0)
            {
                return new LoginView();
            }

            string key = tenant + "-" + loginId.ToString(CultureInfo.InvariantCulture);

            var factory = new DefaultCacheFactory();

            var login = factory.Get<LoginView>(key);

            if(login != null)
            {
                return login;
            }

            login = await GetMetaLoginAsync(tenant, loginId).ConfigureAwait(false);

            var dictionary = GetDictionary(tenant, login);


            factory.Add(tenant + "/dictionary/" + loginId, dictionary, DateTimeOffset.UtcNow.AddHours(2));
            factory.Add(key, login, DateTimeOffset.UtcNow.AddHours(2));

            return login;
        }
예제 #3
0
        private static InventorySetup FromCache(string tenant, int officeId)
        {
            var cache = new DefaultCacheFactory();
            var item  = cache.Get <List <InventorySetup> >(tenant + AppDatesKey);

            return(item?.FirstOrDefault(x => x.OfficeId == officeId));
        }
예제 #4
0
        public static async Task <LoginView> SetCurrentLoginAsync(string tenant, long loginId)
        {
            if (loginId <= 0)
            {
                return(new LoginView());
            }

            string key = tenant + "-" + loginId.ToString(CultureInfo.InvariantCulture);

            var factory = new DefaultCacheFactory();

            var login = factory.Get <LoginView>(key);

            if (login != null)
            {
                return(login);
            }

            login = await GetMetaLoginAsync(tenant, loginId).ConfigureAwait(false);

            var dictionary = GetDictionary(tenant, login);


            factory.Add(tenant + "/dictionary/" + loginId, dictionary, DateTimeOffset.UtcNow.AddHours(2));
            factory.Add(key, login, DateTimeOffset.UtcNow.AddHours(2));

            return(login);
        }
예제 #5
0
        public static FrequencyDates GetFrequencyDates(string tenant, int officeId)
        {
            var cache = new DefaultCacheFactory();
            var item  = cache.Get <List <FrequencyDates> >(tenant + AppDatesKey);

            return(item.FirstOrDefault(x => x.OfficeId == officeId));
        }
예제 #6
0
        public async Task<ActionResult> DoAsync(SignInInfo model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.InvalidModelState(this.ModelState);
            }

            try
            {
                bool isValid =
                    await this.CheckPasswordAsync(this.Tenant, model.Email, model.Password).ConfigureAwait(false);

                if (!isValid)
                {
                    return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
                }

                var result = await DAL.SignIn.DoAsync(this.Tenant, model.Email, model.OfficeId, this.RemoteUser.Browser,
                            this.RemoteUser.IpAddress, model.Culture.Or("en-US")).ConfigureAwait(false);

                string key = "access_tokens_" + this.Tenant;
                var factory = new DefaultCacheFactory();
                factory.Remove(key);

                return await this.OnAuthenticatedAsync(result, model).ConfigureAwait(true);
            }
            catch (DbException ex)
            {
                Log.Information(ex.Message);
                return this.AccessDenied();
            }
        }
예제 #7
0
        public static async Task SaveAsync(string tenant, UserMenuPolicyInfo model)
        {
            await Menus.SavePolicyAsync(tenant, model.OfficeId, model.UserId, model.Allowed, model.Disallowed).ConfigureAwait(false);

            //Invalidate existing cache data
            string prefix  = $"menu_policy_{tenant}_{model.OfficeId}_{model.UserId}";
            var    factory = new DefaultCacheFactory();

            factory.RemoveByPrefix(prefix);
        }
예제 #8
0
        protected async Task RefreshTokens()
        {
            string key     = "access_tokens_" + this.Tenant;
            var    factory = new DefaultCacheFactory();

            factory.Remove(key);

            var tokens = await TokenManager.DAL.AccessTokens.FromStoreAsync(this.Tenant).ConfigureAwait(false);

            factory.Add(key, tokens, DateTimeOffset.Now.AddMinutes(60));
        }
예제 #9
0
        public async Task <ActionResult> RevokeAsync()
        {
            if (!string.IsNullOrWhiteSpace(this.AppUser?.ClientToken))
            {
                await AccessTokens.RevokeAsync(this.Tenant, this.AppUser.ClientToken).ConfigureAwait(true);

                string key     = "access_tokens_" + this.Tenant;
                var    factory = new DefaultCacheFactory();
                factory.Remove(key);
            }

            return(this.Ok("OK"));
        }
예제 #10
0
        public async Task<ActionResult> SignOutAsync()
        {
            if (!string.IsNullOrWhiteSpace(this.AppUser?.ClientToken))
            {
                await AccessTokens.RevokeAsync(this.Tenant, this.AppUser.ClientToken).ConfigureAwait(true);
                string key = "access_tokens_" + this.Tenant;
                var factory = new DefaultCacheFactory();
                factory.Remove(key);
            }

            FormsAuthentication.SignOut();
            return this.View(this.GetRazorView<AreaRegistration>("SignOut/Index.cshtml", this.Tenant));
        }
예제 #11
0
        public async Task <ActionResult> SignOutAsync()
        {
            if (!string.IsNullOrWhiteSpace(this.AppUser?.ClientToken))
            {
                await AccessTokens.RevokeAsync(this.Tenant, this.AppUser.ClientToken).ConfigureAwait(true);

                string key     = "access_tokens_" + this.Tenant;
                var    factory = new DefaultCacheFactory();
                factory.Remove(key);
            }

            FormsAuthentication.SignOut();
            return(this.View(this.GetRazorView <AreaRegistration>("SignOut/Index.cshtml", this.Tenant)));
        }
예제 #12
0
        public static async Task SaveAsync(AppUser appUser, GroupMenuPolicyInfo model)
        {
            if (!appUser.IsAdministrator)
            {
                return;
            }

            await Menus.SaveGroupPolicyAsync(appUser.Tenant, model.OfficeId, model.RoleId, model.MenuIds).ConfigureAwait(false);

            //Invalidate existing cache data
            string prefix  = $"menu_policy_{appUser.Tenant}_{appUser.OfficeId}";
            var    factory = new DefaultCacheFactory();

            factory.RemoveByPrefix(prefix);
        }
예제 #13
0
        public static async Task SaveAsync(AppUser appUser, int officeId, int roleId, List <AccessPolicyInfo> model)
        {
            if (!appUser.IsAdministrator)
            {
                return;
            }

            await AccessPolicy.SaveGroupPolicyAsync(appUser.Tenant, officeId, roleId, model).ConfigureAwait(false);

            //Invalidate existing cache data
            string prefix  = $"access_policy_{appUser.Tenant}";
            var    factory = new DefaultCacheFactory();

            factory.RemoveByPrefix(prefix);
        }
예제 #14
0
        public static async Task <EmployeeInfo> GetAsync(string tenant, int employeeId)
        {
            string key     = tenant + ".employeeinfo." + employeeId;
            var    factory = new DefaultCacheFactory();
            var    model   = factory.Get <EmployeeInfo>(key);

            if (model == null)
            {
                model = await FromStoreAsync(tenant, employeeId).ConfigureAwait(false);

                factory.Add(key, model, DateTimeOffset.UtcNow.AddMinutes(2));
            }

            return(model);
        }
예제 #15
0
        private static async Task<IEnumerable<AccessToken>> GetActiveTokensAsync(string tenant)
        {
            string key = "access_tokens_" + tenant;
            var factory = new DefaultCacheFactory();
            var tokens = factory.Get<IEnumerable<AccessToken>>(key);

            if (tokens != null)
            {
                return tokens;
            }

            tokens = await FromStoreAsync(tenant).ConfigureAwait(false);
            factory.Add(key, tokens, DateTimeOffset.Now.AddMinutes(5));

            return tokens;
        }
예제 #16
0
        public static SearchResult GetResult(string query)
        {
            query = Sanitize(query);
            string key     = "/search-contents/" + query;
            var    factory = new DefaultCacheFactory();

            var result = factory.Get <SearchResult>(key);

            if (result == null)
            {
                result = FromStore(query);
                factory.Add(key, result, DateTimeOffset.UtcNow.AddMinutes(15));
            }

            return(result);
        }
예제 #17
0
파일: ErrorModel.cs 프로젝트: frapid/frapid
        public static async Task<SearchResult> GetResultAsync(string tenant, string query)
        {
            query = Sanitize(query);
            string key = "/search-contents/" + query;
            var factory = new DefaultCacheFactory();

            var result = factory.Get<SearchResult>(key);

            if (result == null)
            {
                result = await FromStoreAsync(tenant, query).ConfigureAwait(false);
                factory.Add(key, result, DateTimeOffset.UtcNow.AddMinutes(15));
            }

            return result;
        }
예제 #18
0
        public static async Task <SearchResult> GetResultAsync(string tenant, string query)
        {
            query = Sanitize(query);
            string key     = "/search-contents/" + query;
            var    factory = new DefaultCacheFactory();

            var result = factory.Get <SearchResult>(key);

            if (result == null)
            {
                result = await FromStoreAsync(tenant, query).ConfigureAwait(false);

                factory.Add(key, result, DateTimeOffset.UtcNow.AddMinutes(15));
            }

            return(result);
        }
예제 #19
0
        private IEnumerable <Menu> GetAllMenus(string tenant, int userId, int officeId)
        {
            string key = $"menu_policy_{tenant}_{officeId}_{userId}";

            var factory = new DefaultCacheFactory();
            var policy  = factory.Get <List <Menu> >(key);

            if (policy != null && policy.Any())
            {
                return(policy);
            }

            policy = this.FromStore(tenant, userId, officeId).ToList();
            factory.Add(key, policy, DateTimeOffset.UtcNow.AddSeconds(GetTotalCacheDuration(tenant)));

            return(policy);
        }
예제 #20
0
        public async Task ValidateAsync()
        {
            string key = $"access_policy_{this.Tenant}_{this.ObjectNamespace}_{this.ObjectName}_{this.LoginId}";

            var factory = new DefaultCacheFactory();
            var policy  = factory.Get <dynamic>(key);

            if (policy != null)
            {
                this.HasAccess = policy.HasAccess;
                return;
            }

            this.HasAccess = await FromStore(this).ConfigureAwait(false);

            factory.Add(key, new { this.HasAccess }, DateTimeOffset.UtcNow.AddSeconds(GetTotalCacheDuration(this.Tenant)));
        }
예제 #21
0
        private static async Task <IEnumerable <AccessToken> > GetActiveTokensAsync(string tenant)
        {
            string key     = "access_tokens_" + tenant;
            var    factory = new DefaultCacheFactory();
            var    tokens  = factory.Get <IEnumerable <AccessToken> >(key);

            if (tokens != null)
            {
                return(tokens);
            }

            tokens = await FromStoreAsync(tenant).ConfigureAwait(false);

            factory.Add(key, tokens, DateTimeOffset.Now.AddMinutes(5));

            return(tokens);
        }
예제 #22
0
        public static async Task <LoginView> GetCurrentAsync(string tenant, long loginId)
        {
            if (loginId == 0)
            {
                return(new LoginView());
            }

            string key = tenant + "-" + loginId.ToString(CultureInfo.InvariantCulture);

            var factory = new DefaultCacheFactory();

            var login = factory.Get <LoginView>(key);

            var view = login ?? await SetCurrentLoginAsync(tenant, loginId).ConfigureAwait(false);

            await UpdateActivityAsync(tenant, view.UserId.To <int>(), view.IpAddress, view.Browser).ConfigureAwait(false);

            return(view);
        }
예제 #23
0
        public static async Task <IEnumerable <AccessToken> > GetActiveTokensAsync(string tenant)
        {
            string key     = "access_tokens_" + tenant;
            var    factory = new DefaultCacheFactory();
            var    tokens  = factory.Get <IEnumerable <AccessToken> >(key);

            if (tokens != null)
            {
                return(tokens);
            }

            tokens = await FromStoreAsync(tenant).ConfigureAwait(false);

            // ReSharper disable once PossibleMultipleEnumeration
            //False positive
            factory.Add(key, tokens, DateTimeOffset.Now.AddMinutes(60));

            return(tokens);
        }
예제 #24
0
        public static LoginView GetCurrent(string tenant, long loginId)
        {
            var login = new LoginView();

            if (loginId == 0)
            {
                return(login);
            }

            string key = tenant + "-" + loginId.ToString(CultureInfo.InvariantCulture);

            var factory = new DefaultCacheFactory();

            login = factory.Get <LoginView>(key);

            var view = login ?? SetCurrentLogin(tenant, loginId);

            UpdateActivity(view.UserId.To <int>(), view.IpAddress, view.Browser);
            return(view);
        }
예제 #25
0
        internal static DnsSpamLookupResult IsListedInSpamDatabase(string tenant, string ipAddress)
        {
            bool isLoopBack = IPAddress.IsLoopback(IPAddress.Parse(ipAddress));

            if (isLoopBack)
            {
                return(new DnsSpamLookupResult());
            }

            string key     = ipAddress + ".spam.check";
            var    factory = new DefaultCacheFactory();

            var isListed = factory.Get <DnsSpamLookupResult>(key);

            if (isListed == null)
            {
                isListed = FromStore(tenant, ipAddress);
                factory.Add(key, isListed, DateTimeOffset.UtcNow.AddHours(2));
            }

            return(isListed);
        }
예제 #26
0
        internal static DnsSpamLookupResult IsListedInSpamDatabase(string tenant, string ipAddress)
        {
            bool isLoopBack = IPAddress.IsLoopback(IPAddress.Parse(ipAddress));

            if (isLoopBack)
            {
                return new DnsSpamLookupResult();
            }

            string key = ipAddress + ".spam.check";
            var factory = new DefaultCacheFactory();

            var isListed = factory.Get<DnsSpamLookupResult>(key);

            if (isListed == null)
            {
                isListed = FromStore(tenant, ipAddress);
                factory.Add(key, isListed, DateTimeOffset.UtcNow.AddHours(2));
            }

            return isListed;
        }
예제 #27
0
        private static string GetDictionaryValue(string tenant, string key)
        {
            string globalLoginId = HttpContext.Current.User.Identity.Name;

            if (!string.IsNullOrWhiteSpace(globalLoginId))
            {
                string cacheKey = tenant + "/dictionary/" + globalLoginId;

                var cache = new DefaultCacheFactory();
                var dictionary = cache.Get<Dictionary<string, object>>(cacheKey);

                if (dictionary != null && dictionary.ContainsKey(key))
                {
                    var value = dictionary?[key];

                    if (value != null)
                    {
                        return value.ToString();
                    }
                }
            }

            return string.Empty;
        }
예제 #28
0
        private static string GetDictionaryValue(string tenant, string key)
        {
            string globalLoginId = HttpContext.Current.User.Identity.Name;

            if (!string.IsNullOrWhiteSpace(globalLoginId))
            {
                string cacheKey = tenant + "/dictionary/" + globalLoginId;

                var cache      = new DefaultCacheFactory();
                var dictionary = cache.Get <Dictionary <string, object> >(cacheKey);

                if (dictionary != null && dictionary.ContainsKey(key))
                {
                    var value = dictionary?[key];

                    if (value != null)
                    {
                        return(value.ToString());
                    }
                }
            }

            return(string.Empty);
        }
예제 #29
0
 public Profile(DebugConnectionFactory connectionFactory, DefaultCacheFactory cacheFactory)
     : this()
 {
     this.connectionFactory = connectionFactory;
     this.cacheFactory      = cacheFactory;
 }
예제 #30
0
        private static void SetInventorySetup(string catalog, List <InventorySetup> inventorySetups)
        {
            var cache = new DefaultCacheFactory();

            cache.Add(catalog + AppDatesKey, inventorySetups, DateTimeOffset.UtcNow.AddHours(1));
        }
예제 #31
0
        static void Main(string[] args)
        {
            //使用MemoryCache作为缓存存储  默认使用HttpRuntime.Cache,需要依赖System.Web  必要时可以进行自由切换
            GlobalCacheProviderFactory.Instance.SetDefaultCacheProviderFactory(new MemoryCacheProviderFactory());

            //设置zookeeper连接信息
            string zkConns = ConfigurationManager.AppSettings["zk_cache_quorums"];

            GlobalZKCacheDependencyOption.Instance.SetDefaultZKCacheDependencyOption(zkConns);

            string node = "/CacheConsole/Test";

            //更新数据
            UpdateData();

            //打印帮助信息
            PrintHelpInfo();

            while (true)
            {
                var input = Console.ReadKey().KeyChar;
                if (input == 'c')
                {
                    DefaultCacheFactory.DefaultCache.ClearOne(node);
                    Console.WriteLine("缓存清理请求已提交,node-->" + node);
                }
                else if (input == 'g')
                {
                    string value = DefaultCacheFactory.DefaultCache.Get <string>(node);
                    if (string.IsNullOrWhiteSpace(value))
                    {
                        value = ReadData();
                        DefaultCacheFactory.DefaultCache.Add(node, value);
                        value = DefaultCacheFactory.DefaultCache.Get <string>(node);
                    }
                    Console.WriteLine("查询到节点{0}的缓存数据值为{1}", node, value);
                }
                else if (input == 'a')
                {
                    string newValue = ReadData();
                    DefaultCacheFactory.DefaultCache.Add(node, newValue);
                    Console.WriteLine("节点{0}的缓存数据已更新,写入值为:{1}", node, newValue);
                }
                else if (input == 'u')
                {
                    string newValue = UpdateData();
                    Console.WriteLine("文件data.zk已更新,新值为:{0}", newValue);
                }
                else if (input == 'r')
                {
                    string newValue = UpdateData();
                    Console.WriteLine("文件data.zk已更新,新值为:{0}", newValue);
                    DefaultCacheFactory.DefaultCache.ClearOne(node);
                    Console.WriteLine("缓存清理请求已提交,node-->" + node);
                }
                else if (input == 'm')
                {
                    GlobalCacheProviderFactory.Instance.SetDefaultCacheProviderFactory(new MemoryCacheProviderFactory());
                    DefaultCacheFactory.Reset();
                    cacheProviderName = "MemoryCache";
                    Console.WriteLine("已切换为MemoryCache作为缓存存储!");
                }
                else if (input == 'd')
                {
                    GlobalCacheProviderFactory.Instance.SetDefaultCacheProviderFactory(new HttpRuntimeCacheProviderFactory());
                    DefaultCacheFactory.Reset();
                    cacheProviderName = "HttpRuntime.Cache";
                    Console.WriteLine("已切换为HttpRuntime.Cache作为缓存存储!");
                }
                else if (input == 'q')
                {
                    Console.WriteLine("再次按任意键退出!");
                    Console.ReadKey();
                    return;
                }
                else if (input == 'h')
                {
                    PrintHelpInfo();
                }
                else
                {
                    PrintHelpInfo();
                }
            }
        }
예제 #32
0
파일: AppUsers.cs 프로젝트: frapid/frapid
        public static async Task<LoginView> GetCurrentAsync(string tenant, long loginId)
        {
            if(loginId == 0)
            {
                return new LoginView();
            }

            string key = tenant + "-" + loginId.ToString(CultureInfo.InvariantCulture);

            var factory = new DefaultCacheFactory();

            var login = factory.Get<LoginView>(key);

            var view =  login ?? await SetCurrentLoginAsync(tenant, loginId).ConfigureAwait(false);

            await UpdateActivityAsync(tenant, view.UserId.To<int>(), view.IpAddress, view.Browser).ConfigureAwait(false);

            return view;
        }
예제 #33
0
 public DebugTests()
 {
     this.connectionFactory = new DebugConnectionFactory();
     this.cacheFactory      = new DefaultCacheFactory();
     this.profile           = new Profile(this.connectionFactory, this.cacheFactory);
 }
예제 #34
0
        public static List <FrequencyDates> GetFrequencyDates(string tenant)
        {
            var cache = new DefaultCacheFactory();

            return(cache.Get <List <FrequencyDates> >(tenant + AppDatesKey));
        }
예제 #35
0
        private static void initPubDI(ContainerBuilder builder, bool defaultUserAuth = true)
        {
            builder.Register(c => new Log4NetLogAdapter(AppDomain.CurrentDomain.BaseDirectory + "Config/log4net.config")).As <ILogAdapter>().SingleInstance();

            //注册缓存CacheFactory
            int redisCacheServerPort;
            var redisCacheServer    = ConfigurationManager.AppSettings["RedisCacheServer"];
            var redisCacheServerPwd = ConfigurationManager.AppSettings["RedisCacheServerPwd"];

            int.TryParse(ConfigurationManager.AppSettings["RedisCacheServerPort"], out redisCacheServerPort);
            var cache = CacheFactory.Build("RuntimeCache", settings =>
            {
                settings.WithSystemRuntimeCacheHandle("RuntimeCache")
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(10))
                .And
                .WithRedisConfiguration("RedisUserCache", config =>
                {
                    config.WithAllowAdmin()
                    .WithDatabase(15)
                    .WithPassword(redisCacheServerPwd)
                    .WithEndpoint(redisCacheServer, redisCacheServerPort);
                })
                .WithMaxRetries(100)
                .WithRetryTimeout(50)
                .WithRedisBackPlate("RedisUserCache")
                .WithRedisCacheHandle("RedisUserCache", true)
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(30));
            });

            var presistentCache = CacheFactory.Build("RuntimeCache2", settings =>
            {
                settings.WithSystemRuntimeCacheHandle("RuntimeCache2")
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(60))
                .And
                .WithRedisConfiguration("RedisPresistentCache", config =>
                {
                    config.WithAllowAdmin()
                    .WithDatabase(15)
                    .WithPassword(redisCacheServerPwd)
                    .WithEndpoint(redisCacheServer, redisCacheServerPort);
                })
                .WithMaxRetries(100)
                .WithRetryTimeout(50)
                .WithRedisBackPlate("RedisPresistentCache")
                .WithRedisCacheHandle("RedisPresistentCache", true)
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromDays(30));
            });

            var tokenCache = CacheFactory.Build("RuntimeTokenCache", settings =>
            {
                settings.WithSystemRuntimeCacheHandle("RuntimeTokenCache")
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromMinutes(60))
                .And
                .WithRedisConfiguration("RedisTokenCache", config =>
                {
                    config.WithAllowAdmin()
                    .WithDatabase(15)
                    .WithPassword(redisCacheServerPwd)
                    .WithEndpoint(redisCacheServer, redisCacheServerPort);
                })
                .WithMaxRetries(100)
                .WithRetryTimeout(50)
                .WithRedisBackPlate("RedisTokenCache")
                .WithRedisCacheHandle("RedisTokenCache", true)
                .WithExpiration(ExpirationMode.Sliding, TimeSpan.FromDays(30));
            });

            DefaultCacheFactory.InitCacheInstance(cache, presistentCache, tokenCache, 1);

            //注册ID生成器
            byte serverID = 0;

            byte.TryParse(ConfigurationManager.AppSettings["IDGenServerID"], out serverID);
            builder.Register(c => new DefaultIdBuilder(serverID, "RedisQueueConfig")).As <IdBuilder>().SingleInstance();  //NextIntID与Queue保存在同台Redis中持久化


            //是否使用默认用户验证等信息
            if (defaultUserAuth)
            {
                //服务
                //用户业务逻辑
                builder.Register(c => new UserBL()).As <IUserBL>().SingleInstance();
                //containerBuilder.Register(c => new AdminUserBL()).As<AdminUserBL>().SingleInstance();

                //用户身份认证
                builder.Register(c => new AuthenticationBL()).As <IAuthenticationBL>().InstancePerRequest();
                //containerBuilder.Register(c => new FormsAuthenticationBL()).As<IAuthenticationBL>().InstancePerApiRequest();

                //用户权限处理
                builder.Register(c => new PermissionBL()).As <IPermissionBL>().SingleInstance();

                //用户操作日志处理
                builder.Register(c => new OprtLogBL()).As <IOprtLogBL>().SingleInstance();
            }
        }
예제 #36
0
        public static void SetApplicationDates(string catalog, List <FrequencyDates> applicationDates)
        {
            var cache = new DefaultCacheFactory();

            cache.Add(catalog + AppDatesKey, applicationDates, DateTimeOffset.UtcNow.AddHours(1));
        }