예제 #1
0
        public virtual IUserRoleState Get(string roleId, bool forCreation, bool nullAllowed)
        {
            UserRoleId globalId = new UserRoleId(_userState.UserId, roleId);

            if (_loadedUserRoleStates.ContainsKey(globalId))
            {
                return(_loadedUserRoleStates[globalId]);
            }
            if (forCreation || ForReapplying)
            {
                var state = new UserRoleState(ForReapplying);
                state.UserRoleId = globalId;
                _loadedUserRoleStates.Add(globalId, state);
                return(state);
            }
            else
            {
                var state = UserRoleStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedUserRoleStates.Add(globalId, state);
                }
                return(state);
            }
        }
예제 #2
0
        public virtual IUserRoleState Get(string roleId)
        {
            UserRoleId globalId = new UserRoleId(_userState.UserId, roleId);

            if (_loadedUserRoleStates.ContainsKey(globalId))
            {
                return(_loadedUserRoleStates[globalId]);
            }
            var state = UserRoleStateDao.Get(globalId);

            _loadedUserRoleStates.Add(globalId, state);
            return(state);
        }