protected void ThrowOnInconsistentCommands(IShipmentPackageCommand command, IShipmentPackageContentCommand innerCommand) { var properties = command as ICreateOrMergePatchOrDeleteShipmentPackage; var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveShipmentPackageContent; if (properties == null || innerProperties == null) { return; } if (innerProperties.ShipmentPackageId == default(ShipmentPackageId)) { innerProperties.ShipmentPackageId = properties.ShipmentPackageId; } else { var outerShipmentPackageIdName = "ShipmentPackageId"; var outerShipmentPackageIdValue = properties.ShipmentPackageId; var innerShipmentPackageIdName = "ShipmentPackageId"; var innerShipmentPackageIdValue = innerProperties.ShipmentPackageId; ThrowOnInconsistentIds(innerProperties, innerShipmentPackageIdName, innerShipmentPackageIdValue, outerShipmentPackageIdName, outerShipmentPackageIdValue); } }// END ThrowOnInconsistentCommands /////////////////////
}// END ThrowOnInconsistentCommands ///////////////////// protected virtual IShipmentPackageContentEvent Map(IShipmentPackageContentCommand c, IShipmentPackageCommand outerCommand, long version, IShipmentPackageState outerState) { var create = (c.CommandType == CommandType.Create) ? (c as ICreateShipmentPackageContent) : null; if (create != null) { return(MapCreate(create, outerCommand, version, outerState)); } var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchShipmentPackageContent) : null; if (merge != null) { return(MapMergePatch(merge, outerCommand, version, outerState)); } var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveShipmentPackageContent) : null; if (remove != null) { return(MapRemove(remove, outerCommand, version)); } throw new NotSupportedException(); }
void IShipmentPackageContentCommands.Remove(IShipmentPackageContentCommand c) { _innerCommands.Remove((CreateOrMergePatchOrRemoveShipmentPackageContentDto)c); }
public void Remove(IShipmentPackageContentCommand c) { _innerCommands.Remove(c); }
public void Add(IShipmentPackageContentCommand c) { _innerCommands.Add(c); }