示例#1
0
        public virtual void MergePatch(IMergePatchUser c)
        {
            IUserStateMergePatched e = Map(c);

            Apply(e);
        }
 public virtual void When(IMergePatchUser c)
 {
     Update(c, ar => ar.MergePatch(c));
 }
示例#3
0
        protected virtual IUserStateMergePatched Map(IMergePatchUser c)
        {
            var stateEventId         = new UserEventId(c.UserId, c.Version);
            IUserStateMergePatched e = NewUserStateMergePatched(stateEventId);

            e.UserName                              = c.UserName;
            e.AccessFailedCount                     = c.AccessFailedCount;
            e.Email                                 = c.Email;
            e.EmailConfirmed                        = c.EmailConfirmed;
            e.LockoutEnabled                        = c.LockoutEnabled;
            e.LockoutEndDateUtc                     = c.LockoutEndDateUtc;
            e.PasswordHash                          = c.PasswordHash;
            e.PhoneNumber                           = c.PhoneNumber;
            e.PhoneNumberConfirmed                  = c.PhoneNumberConfirmed;
            e.TwoFactorEnabled                      = c.TwoFactorEnabled;
            e.SecurityStamp                         = c.SecurityStamp;
            e.Active                                = c.Active;
            e.IsPropertyUserNameRemoved             = c.IsPropertyUserNameRemoved;
            e.IsPropertyAccessFailedCountRemoved    = c.IsPropertyAccessFailedCountRemoved;
            e.IsPropertyEmailRemoved                = c.IsPropertyEmailRemoved;
            e.IsPropertyEmailConfirmedRemoved       = c.IsPropertyEmailConfirmedRemoved;
            e.IsPropertyLockoutEnabledRemoved       = c.IsPropertyLockoutEnabledRemoved;
            e.IsPropertyLockoutEndDateUtcRemoved    = c.IsPropertyLockoutEndDateUtcRemoved;
            e.IsPropertyPasswordHashRemoved         = c.IsPropertyPasswordHashRemoved;
            e.IsPropertyPhoneNumberRemoved          = c.IsPropertyPhoneNumberRemoved;
            e.IsPropertyPhoneNumberConfirmedRemoved = c.IsPropertyPhoneNumberConfirmedRemoved;
            e.IsPropertyTwoFactorEnabledRemoved     = c.IsPropertyTwoFactorEnabledRemoved;
            e.IsPropertySecurityStampRemoved        = c.IsPropertySecurityStampRemoved;
            e.IsPropertyActiveRemoved               = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            var version = c.Version;

            foreach (IUserRoleCommand innerCommand in c.UserRoleCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserRoleEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddUserRoleEvent(innerEvent);
            }

            foreach (IUserClaimCommand innerCommand in c.UserClaimCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserClaimEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddUserClaimEvent(innerEvent);
            }

            foreach (IUserPermissionCommand innerCommand in c.UserPermissionCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserPermissionEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddUserPermissionEvent(innerEvent);
            }

            foreach (IUserLoginCommand innerCommand in c.UserLoginCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserLoginEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddUserLoginEvent(innerEvent);
            }


            return(e);
        }
示例#4
0
 void IUserApplicationService.When(IMergePatchUser c)
 {
     this.When((MergePatchUserDto)c);
 }