Exemplo n.º 1
0
        protected virtual IUserStateCreated Map(ICreateUser c)
        {
            var stateEventId    = new UserStateEventId(c.UserId, c.Version);
            IUserStateCreated e = NewUserStateCreated(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;
            ReflectUtils.CopyPropertyValue("CommandId", c, e);


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            var version = c.Version;

            foreach (ICreateUserRole innerCommand in c.UserRoles)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserRoleStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddUserRoleEvent(innerEvent);
            }

            foreach (ICreateUserClaim innerCommand in c.UserClaims)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserClaimStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddUserClaimEvent(innerEvent);
            }

            foreach (ICreateUserPermission innerCommand in c.UserPermissions)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserPermissionStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddUserPermissionEvent(innerEvent);
            }

            foreach (ICreateUserLogin innerCommand in c.UserLogins)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IUserLoginStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddUserLoginEvent(innerEvent);
            }


            return(e);
        }
Exemplo n.º 2
0
        protected UserStateDeleted NewUserStateDeleted(string commandId, string requesterId)
        {
            var stateEventId = new UserStateEventId(_state.UserId, ((IUserStateProperties)_state).Version);
            var e            = NewUserStateDeleted(stateEventId);

            e.CommandId = commandId;

            e.CreatedBy = (string)requesterId;
            e.CreatedAt = DateTime.Now;

            return(e);
        }
Exemplo n.º 3
0
        protected virtual IUserStateDeleted Map(IDeleteUser c)
        {
            var stateEventId    = new UserStateEventId(c.UserId, c.Version);
            IUserStateDeleted e = NewUserStateDeleted(stateEventId);

            ReflectUtils.CopyPropertyValue("CommandId", c, e);


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;


            return(e);
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            UserStateEventId other = obj as UserStateEventId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.UserId, other.UserId) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
Exemplo n.º 5
0
 public UserStateEventIdDto(UserStateEventId val)
 {
     this._value = val;
 }
Exemplo n.º 6
0
 public UserStateDeleted(UserStateEventId stateEventId) : base(stateEventId)
 {
 }
Exemplo n.º 7
0
 public UserStateMergePatched(UserStateEventId stateEventId) : base(stateEventId)
 {
 }
Exemplo n.º 8
0
 public UserStateCreated(UserStateEventId stateEventId) : base(stateEventId)
 {
 }
Exemplo n.º 9
0
 protected UserStateEventBase(UserStateEventId stateEventId)
 {
     this.StateEventId = stateEventId;
 }
Exemplo n.º 10
0
 private UserStateDeleted NewUserStateDeleted(UserStateEventId stateEventId)
 {
     return(new UserStateDeleted(stateEventId));
 }
Exemplo n.º 11
0
 private UserStateMergePatched NewUserStateMergePatched(UserStateEventId stateEventId)
 {
     return(new UserStateMergePatched(stateEventId));
 }