Ejemplo n.º 1
0
        public virtual IUserLoginState Get(LoginKey loginKey, bool forCreation, bool nullAllowed)
        {
            UserLoginId globalId = new UserLoginId(_userState.UserId, loginKey);

            if (_loadedUserLoginStates.ContainsKey(globalId))
            {
                return(_loadedUserLoginStates[globalId]);
            }
            if (forCreation || ForReapplying)
            {
                var state = new UserLoginState(ForReapplying);
                state.UserLoginId = globalId;
                _loadedUserLoginStates.Add(globalId, state);
                return(state);
            }
            else
            {
                var state = UserLoginStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedUserLoginStates.Add(globalId, state);
                }
                return(state);
            }
        }
Ejemplo n.º 2
0
        public virtual IUserLoginState ToUserLoginState()
        {
            var state = new UserLoginState(true);

            state.LoginKey = this.LoginKey;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.UserId    = this.UserId;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Ejemplo n.º 3
0
 public static CreateUserLogin ToCreateUserLogin(this UserLoginState state)
 {
     return(state.ToCreateUserLogin <CreateUserLogin>());
 }
Ejemplo n.º 4
0
 public static MergePatchUserLogin ToMergePatchUserLogin(this UserLoginState state)
 {
     return(state.ToMergePatchUserLogin <MergePatchUserLogin>());
 }
Ejemplo n.º 5
0
 public static RemoveUserLogin ToRemoveUserLogin(this UserLoginState state)
 {
     return(state.ToRemoveUserLogin <RemoveUserLogin>());
 }
Ejemplo n.º 6
0
 public static IUserLoginCommand ToCreateOrMergePatchUserLogin(this UserLoginState state)
 {
     return(state.ToCreateOrMergePatchUserLogin <CreateUserLogin, MergePatchUserLogin>());
 }