Beispiel #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);
            }
        }
Beispiel #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);
        }