Ejemplo n.º 1
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected void ThrowOnInconsistentCommands(IUserCommand command, IUserPermissionCommand innerCommand)
        {
            var properties      = command as ICreateOrMergePatchOrDeleteUser;
            var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveUserPermission;

            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 /////////////////////
Ejemplo n.º 2
0
        }// END Map(IRemove... ////////////////////////////

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

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

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

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

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

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 3
0
 public void Remove(IUserPermissionCommand c)
 {
     _innerCommands.Remove(c);
 }
Ejemplo n.º 4
0
 public void Add(IUserPermissionCommand c)
 {
     _innerCommands.Add(c);
 }
Ejemplo n.º 5
0
 void IUserPermissionCommands.Remove(IUserPermissionCommand c)
 {
     _innerCommands.Remove((CreateOrMergePatchOrRemoveUserPermissionDto)c);
 }
Ejemplo n.º 6
0
 public UserPermissionService(IUserPermissionQuery query, IUserPermissionCommand userPermissionCommand)
 {
     _query   = query;
     _command = userPermissionCommand;
 }