Beispiel #1
0
        protected void ThrowOnInconsistentCommands(IUserCommand command, IUserRoleCommand innerCommand)
        {
            var properties      = command as ICreateOrMergePatchOrDeleteUser;
            var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveUserRole;

            if (properties == null || innerProperties == null)
            {
                return;
            }
            var outerUserIdName  = "UserId";
            var outerUserIdValue = properties.UserId;
            var innerUserIdName  = "UserId";
            var innerUserIdValue = innerProperties.UserId;

            SetNullInnerIdOrThrowOnInconsistentIds(innerProperties, innerUserIdName, innerUserIdValue, outerUserIdName, outerUserIdValue);
        }// END ThrowOnInconsistentCommands /////////////////////
Beispiel #2
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected virtual IUserRoleEvent Map(IUserRoleCommand c, IUserCommand outerCommand, long version, IUserState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateUserRole) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchUserRole) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveUserRole) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Beispiel #3
0
 public void Remove(IUserRoleCommand c)
 {
     _innerCommands.Remove(c);
 }
Beispiel #4
0
 public void Add(IUserRoleCommand c)
 {
     _innerCommands.Add(c);
 }
Beispiel #5
0
 public UserRoleRepository(IUserRoleCommand userRoleCommand, IUserRoleQuery userRoleQuery)
 {
     _userRoleCommand = userRoleCommand;
     _userRoleQuery   = userRoleQuery;
 }
Beispiel #6
0
 void IUserRoleCommands.Remove(IUserRoleCommand c)
 {
     _innerCommands.Remove((CreateOrMergePatchOrRemoveUserRoleDto)c);
 }