예제 #1
0
        public static void RefreshUserRoleMappings()
        {
            MappingService service  = new MappingService();
            var            mappings = service.GetUserRoleMapping().Result;

            if (mappings == null)
            {
                mappings = Enumerable.Empty <UserRoleMapping>();
            }

            lock (lockobject)
            {
                CacheHelper.Remove("UserRoleMapping");
                CacheHelper.Insert("UserRoleMapping", mappings);
            }
        }
예제 #2
0
        public static IEnumerable <UserRoleMapping> GetUserRoleMappings()
        {
            var userRoleMappings = (IEnumerable <UserRoleMapping>)CacheHelper.Get("UserRoleMapping", () =>
            {
                MappingService service = new MappingService();

                var mappings = service.GetUserRoleMapping().Result;

                if (mappings == null)
                {
                    mappings = Enumerable.Empty <UserRoleMapping>();
                }

                lock (lockobject)
                {
                    CacheHelper.Insert("UserRoleMapping", mappings);
                }
            });

            return(userRoleMappings);
        }