public static TCreateUserClaimMvo ToCreateUserClaimMvo <TCreateUserClaimMvo>(this IUserClaimMvoState state) where TCreateUserClaimMvo : ICreateUserClaimMvo, new() { var cmd = new TCreateUserClaimMvo(); cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion; cmd.UserClaimId = state.UserClaimId; cmd.ClaimType = state.ClaimType; cmd.ClaimValue = state.ClaimValue; cmd.Version = ((IUserClaimMvoStateProperties)state).Version; cmd.Active = ((IUserClaimMvoStateProperties)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 static TDeleteUserClaimMvo ToDeleteUserClaimMvo <TDeleteUserClaimMvo>(this IUserClaimMvoState state) where TDeleteUserClaimMvo : IDeleteUserClaimMvo, new() { var cmd = new TDeleteUserClaimMvo(); cmd.UserClaimId = state.UserClaimId; cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion; return(cmd); }
public IUserClaimMvoState Get(UserClaimId id) { IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IUserClaimMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Save(IUserClaimMvoState state) { CurrentSession.SaveOrUpdate(state); var saveable = state as ISaveable; if (saveable != null) { saveable.Save(); } }
public IUserClaimMvoState Get(UserClaimId id) { IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState> (id); if (state == null) { state = new UserClaimMvoState(); (state as UserClaimMvoState).UserClaimId = id; } return(state); }
public IUserClaimMvoState Get(UserClaimId id, bool nullAllowed) { IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState> (id); if (!nullAllowed && state == null) { state = new UserClaimMvoState(); (state as UserClaimMvoState).UserClaimId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IUserClaimMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IUserClaimMvoState> GetAsync(UserClaimId userClaimId) { IUserClaimMvoState state = null; var idObj = UserClaimMvoProxyUtils.ToIdString(userClaimId); var uriParameters = new UserClaimMvoUriParameters(); uriParameters.Id = idObj; var req = new UserClaimMvoGetRequest(uriParameters); var resp = await _ramlClient.UserClaimMvo.Get(req); UserClaimMvoProxyUtils.ThrowOnHttpResponseError(resp); state = resp.Content; return(state); }
public void Save(IUserClaimMvoState state) { IUserClaimMvoState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IUserClaimMvoState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } }
public static IUserClaimMvoCommand ToCreateOrMergePatchUserClaimMvo <TCreateUserClaimMvo, TMergePatchUserClaimMvo>(this IUserClaimMvoState state) where TCreateUserClaimMvo : ICreateUserClaimMvo, new() where TMergePatchUserClaimMvo : IMergePatchUserClaimMvo, new() { bool bUnsaved = ((IUserClaimMvoState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateUserClaimMvo <TCreateUserClaimMvo>()); } else { return(state.ToMergePatchUserClaimMvo <TMergePatchUserClaimMvo>()); } }
public UserClaimMvoAggregate(IUserClaimMvoState state) { _state = state; }
public override IUserClaimMvoAggregate GetUserClaimMvoAggregate(IUserClaimMvoState state) { return(new UserClaimMvoAggregate(state)); }
protected bool IsRepeatedCommand(IUserClaimMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IUserClaimMvoState state) { bool repeated = false; if (((IUserClaimMvoStateProperties)state).UserVersion > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IUserClaimMvoEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
public abstract IUserClaimMvoAggregate GetUserClaimMvoAggregate(IUserClaimMvoState state);
public UserClaimMvoStateDtoWrapper(IUserClaimMvoState state) { this._state = state; }
public UserClaimMvoStateDtoWrapper() { this._state = new UserClaimMvoState(); }
public static TMergePatchUserClaimMvo ToMergePatchUserClaimMvo <TMergePatchUserClaimMvo>(this IUserClaimMvoState state) where TMergePatchUserClaimMvo : IMergePatchUserClaimMvo, new() { var cmd = new TMergePatchUserClaimMvo(); cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion; cmd.UserClaimId = state.UserClaimId; cmd.ClaimType = state.ClaimType; cmd.ClaimValue = state.ClaimValue; cmd.Version = ((IUserClaimMvoStateProperties)state).Version; cmd.Active = ((IUserClaimMvoStateProperties)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.ClaimType == null) { cmd.IsPropertyClaimTypeRemoved = true; } if (state.ClaimValue == null) { cmd.IsPropertyClaimValueRemoved = true; } 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); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IUserClaimMvoAggregate aggregate, IUserClaimMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IUserClaimMvoStateProperties)state).UserVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IUserClaimMvoAggregate, IUserClaimMvoState>(aggregate, state, aggregate.Changes)); } }