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); }
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); }
public IUserLoginMvoState Get(UserLoginId id) { IUserLoginMvoState state = CurrentSession.Get <UserLoginMvoState> (id); if (state == null) { state = new UserLoginMvoState(); (state as UserLoginMvoState).UserLoginId = id; } return(state); }
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); }
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(); } }
public UserLoginMvoAggregate(IUserLoginMvoState state) { _state = state; }
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); }
public UserLoginMvoStateDtoWrapper(IUserLoginMvoState state) { this._state = state; }
public UserLoginMvoStateDtoWrapper() { this._state = new UserLoginMvoState(); }
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); }
public override IUserLoginMvoAggregate GetUserLoginMvoAggregate(IUserLoginMvoState state) { return(new UserLoginMvoAggregate(state)); }
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>()); } }