public virtual void Initialize(IUserRoleMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.UserRoleMvoEventId.UserRoleId;
            var state       = new UserRoleMvoState();

            state.UserRoleId = aggregateId;
            var aggregate = (UserRoleMvoAggregate)GetUserRoleMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #2
0
        public virtual IUserRoleMvoState ToUserRoleMvoState()
        {
            var state = new UserRoleMvoState(true);

            state.UserRoleId = this.UserRoleId;
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            state.UserUserName = this.UserUserName;
            if (this.UserAccessFailedCount != null && this.UserAccessFailedCount.HasValue)
            {
                state.UserAccessFailedCount = this.UserAccessFailedCount.Value;
            }
            state.UserEmail = this.UserEmail;
            if (this.UserEmailConfirmed != null && this.UserEmailConfirmed.HasValue)
            {
                state.UserEmailConfirmed = this.UserEmailConfirmed.Value;
            }
            if (this.UserLockoutEnabled != null && this.UserLockoutEnabled.HasValue)
            {
                state.UserLockoutEnabled = this.UserLockoutEnabled.Value;
            }
            state.UserLockoutEndDateUtc = this.UserLockoutEndDateUtc;
            state.UserPasswordHash      = this.UserPasswordHash;
            state.UserPhoneNumber       = this.UserPhoneNumber;
            if (this.UserPhoneNumberConfirmed != null && this.UserPhoneNumberConfirmed.HasValue)
            {
                state.UserPhoneNumberConfirmed = this.UserPhoneNumberConfirmed.Value;
            }
            if (this.UserTwoFactorEnabled != null && this.UserTwoFactorEnabled.HasValue)
            {
                state.UserTwoFactorEnabled = this.UserTwoFactorEnabled.Value;
            }
            state.UserSecurityStamp = this.UserSecurityStamp;
            state.UserCreatedBy     = this.UserCreatedBy;
            if (this.UserCreatedAt != null && this.UserCreatedAt.HasValue)
            {
                state.UserCreatedAt = this.UserCreatedAt.Value;
            }
            state.UserUpdatedBy = this.UserUpdatedBy;
            if (this.UserUpdatedAt != null && this.UserUpdatedAt.HasValue)
            {
                state.UserUpdatedAt = this.UserUpdatedAt.Value;
            }
            if (this.UserActive != null && this.UserActive.HasValue)
            {
                state.UserActive = this.UserActive.Value;
            }
            if (this.UserDeleted != null && this.UserDeleted.HasValue)
            {
                state.UserDeleted = this.UserDeleted.Value;
            }
            if (this.UserVersion != null && this.UserVersion.HasValue)
            {
                state.UserVersion = this.UserVersion.Value;
            }
            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);
        }
Example #3
0
 public static CreateUserRoleMvo ToCreateUserRoleMvo(this UserRoleMvoState state)
 {
     return(state.ToCreateUserRoleMvo <CreateUserRoleMvo>());
 }
Example #4
0
 public static MergePatchUserRoleMvo ToMergePatchUserRoleMvo(this UserRoleMvoState state)
 {
     return(state.ToMergePatchUserRoleMvo <MergePatchUserRoleMvo>());
 }
Example #5
0
 public static DeleteUserRoleMvo ToDeleteUserRoleMvo(this UserRoleMvoState state)
 {
     return(state.ToDeleteUserRoleMvo <DeleteUserRoleMvo>());
 }
Example #6
0
 public static IUserRoleMvoCommand ToCreateOrMergePatchUserRoleMvo(this UserRoleMvoState state)
 {
     return(state.ToCreateOrMergePatchUserRoleMvo <CreateUserRoleMvo, MergePatchUserRoleMvo>());
 }