예제 #1
0
        public static TCreateUserLoginMvo ToCreateUserLoginMvo <TCreateUserLoginMvo>(this IUserLoginMvoState state)
            where TCreateUserLoginMvo : ICreateUserLoginMvo, new()
        {
            var cmd = new TCreateUserLoginMvo();

            cmd.UserVersion = ((IUserLoginMvoStateProperties)state).UserVersion;

            cmd.UserLoginId              = state.UserLoginId;
            cmd.Version                  = ((IUserLoginMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserLoginMvoStateProperties)state).Active;
            cmd.UserUserName             = state.UserUserName;
            cmd.UserAccessFailedCount    = state.UserAccessFailedCount;
            cmd.UserEmail                = state.UserEmail;
            cmd.UserEmailConfirmed       = state.UserEmailConfirmed;
            cmd.UserLockoutEnabled       = state.UserLockoutEnabled;
            cmd.UserLockoutEndDateUtc    = state.UserLockoutEndDateUtc;
            cmd.UserPasswordHash         = state.UserPasswordHash;
            cmd.UserPhoneNumber          = state.UserPhoneNumber;
            cmd.UserPhoneNumberConfirmed = state.UserPhoneNumberConfirmed;
            cmd.UserTwoFactorEnabled     = state.UserTwoFactorEnabled;
            cmd.UserSecurityStamp        = state.UserSecurityStamp;
            cmd.UserCreatedBy            = state.UserCreatedBy;
            cmd.UserCreatedAt            = state.UserCreatedAt;
            cmd.UserUpdatedBy            = state.UserUpdatedBy;
            cmd.UserUpdatedAt            = state.UserUpdatedAt;
            cmd.UserActive               = state.UserActive;
            cmd.UserDeleted              = state.UserDeleted;
            return(cmd);
        }
        public IUserLoginMvoState Get(UserLoginId id)
        {
            IUserLoginMvoState state = CurrentSession.Get <UserLoginMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserLoginMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
예제 #3
0
        public static TDeleteUserLoginMvo ToDeleteUserLoginMvo <TDeleteUserLoginMvo>(this IUserLoginMvoState state)
            where TDeleteUserLoginMvo : IDeleteUserLoginMvo, new()
        {
            var cmd = new TDeleteUserLoginMvo();

            cmd.UserLoginId = state.UserLoginId;
            cmd.UserVersion = ((IUserLoginMvoStateProperties)state).UserVersion;

            return(cmd);
        }
예제 #4
0
        public IUserLoginMvoState Get(UserLoginId id)
        {
            IUserLoginMvoState state = CurrentSession.Get <UserLoginMvoState> (id);

            if (state == null)
            {
                state = new UserLoginMvoState();
                (state as UserLoginMvoState).UserLoginId = id;
            }
            return(state);
        }
예제 #5
0
        public void Save(IUserLoginMvoState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
        public IUserLoginMvoState Get(UserLoginId id, bool nullAllowed)
        {
            IUserLoginMvoState state = CurrentSession.Get <UserLoginMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new UserLoginMvoState();
                (state as UserLoginMvoState).UserLoginId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserLoginMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
예제 #7
0
        public async Task <IUserLoginMvoState> GetAsync(UserLoginId userLoginId)
        {
            IUserLoginMvoState state = null;
            var idObj         = UserLoginMvoProxyUtils.ToIdString(userLoginId);
            var uriParameters = new UserLoginMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new UserLoginMvoGetRequest(uriParameters);

            var resp = await _ramlClient.UserLoginMvo.Get(req);

            UserLoginMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
        public void Save(IUserLoginMvoState state)
        {
            IUserLoginMvoState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IUserLoginMvoState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
예제 #9
0
 public UserLoginMvoAggregate(IUserLoginMvoState state)
 {
     _state = state;
 }
예제 #10
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IUserLoginMvoAggregate aggregate, IUserLoginMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IUserLoginMvoStateProperties)state).UserVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IUserLoginMvoAggregate, IUserLoginMvoState>(aggregate, state, aggregate.Changes));
     }
 }
 public abstract IUserLoginMvoAggregate GetUserLoginMvoAggregate(IUserLoginMvoState state);
        protected bool IsRepeatedCommand(IUserLoginMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IUserLoginMvoState state)
        {
            bool repeated = false;

            if (((IUserLoginMvoStateProperties)state).UserVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.FindLastEvent(typeof(IUserLoginMvoStateEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
예제 #13
0
 public UserLoginMvoStateDtoWrapper(IUserLoginMvoState state)
 {
     this._state = state;
 }
예제 #14
0
 public UserLoginMvoStateDtoWrapper()
 {
     this._state = new UserLoginMvoState();
 }
예제 #15
0
        public static TMergePatchUserLoginMvo ToMergePatchUserLoginMvo <TMergePatchUserLoginMvo>(this IUserLoginMvoState state)
            where TMergePatchUserLoginMvo : IMergePatchUserLoginMvo, new()
        {
            var cmd = new TMergePatchUserLoginMvo();

            cmd.UserVersion = ((IUserLoginMvoStateProperties)state).UserVersion;

            cmd.UserLoginId              = state.UserLoginId;
            cmd.Version                  = ((IUserLoginMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserLoginMvoStateProperties)state).Active;
            cmd.UserUserName             = state.UserUserName;
            cmd.UserAccessFailedCount    = state.UserAccessFailedCount;
            cmd.UserEmail                = state.UserEmail;
            cmd.UserEmailConfirmed       = state.UserEmailConfirmed;
            cmd.UserLockoutEnabled       = state.UserLockoutEnabled;
            cmd.UserLockoutEndDateUtc    = state.UserLockoutEndDateUtc;
            cmd.UserPasswordHash         = state.UserPasswordHash;
            cmd.UserPhoneNumber          = state.UserPhoneNumber;
            cmd.UserPhoneNumberConfirmed = state.UserPhoneNumberConfirmed;
            cmd.UserTwoFactorEnabled     = state.UserTwoFactorEnabled;
            cmd.UserSecurityStamp        = state.UserSecurityStamp;
            cmd.UserCreatedBy            = state.UserCreatedBy;
            cmd.UserCreatedAt            = state.UserCreatedAt;
            cmd.UserUpdatedBy            = state.UserUpdatedBy;
            cmd.UserUpdatedAt            = state.UserUpdatedAt;
            cmd.UserActive               = state.UserActive;
            cmd.UserDeleted              = state.UserDeleted;

            if (state.UserUserName == null)
            {
                cmd.IsPropertyUserUserNameRemoved = true;
            }
            if (state.UserEmail == null)
            {
                cmd.IsPropertyUserEmailRemoved = true;
            }
            if (state.UserLockoutEndDateUtc == null)
            {
                cmd.IsPropertyUserLockoutEndDateUtcRemoved = true;
            }
            if (state.UserPasswordHash == null)
            {
                cmd.IsPropertyUserPasswordHashRemoved = true;
            }
            if (state.UserPhoneNumber == null)
            {
                cmd.IsPropertyUserPhoneNumberRemoved = true;
            }
            if (state.UserSecurityStamp == null)
            {
                cmd.IsPropertyUserSecurityStampRemoved = true;
            }
            if (state.UserCreatedBy == null)
            {
                cmd.IsPropertyUserCreatedByRemoved = true;
            }
            if (state.UserUpdatedBy == null)
            {
                cmd.IsPropertyUserUpdatedByRemoved = true;
            }
            return(cmd);
        }
예제 #16
0
 public override IUserLoginMvoAggregate GetUserLoginMvoAggregate(IUserLoginMvoState state)
 {
     return(new UserLoginMvoAggregate(state));
 }
예제 #17
0
        public static IUserLoginMvoCommand ToCreateOrMergePatchUserLoginMvo <TCreateUserLoginMvo, TMergePatchUserLoginMvo>(this IUserLoginMvoState state)
            where TCreateUserLoginMvo : ICreateUserLoginMvo, new()
            where TMergePatchUserLoginMvo : IMergePatchUserLoginMvo, new()
        {
            bool bUnsaved = ((IUserLoginMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateUserLoginMvo <TCreateUserLoginMvo>());
            }
            else
            {
                return(state.ToMergePatchUserLoginMvo <TMergePatchUserLoginMvo>());
            }
        }