}// END Map(IRemove... //////////////////////////// protected virtual IShipmentItemEvent Map(IShipmentItemCommand c, IShipmentCommand outerCommand, long version, IShipmentState outerState) { var create = (c.CommandType == CommandType.Create) ? (c as ICreateShipmentItem) : null; if (create != null) { return(MapCreate(create, outerCommand, version, outerState)); } var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchShipmentItem) : null; if (merge != null) { return(MapMergePatch(merge, outerCommand, version, outerState)); } throw new NotSupportedException(); }
}// END ThrowOnInconsistentCommands ///////////////////// protected void ThrowOnInconsistentCommands(IShipmentCommand command, IShipmentItemCommand innerCommand) { var properties = command as ICreateOrMergePatchOrDeleteShipment; var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveShipmentItem; if (properties == null || innerProperties == null) { return; } if (innerProperties.ShipmentId == default(string)) { innerProperties.ShipmentId = properties.ShipmentId; } else { var outerShipmentIdName = "ShipmentId"; var outerShipmentIdValue = properties.ShipmentId; var innerShipmentIdName = "ShipmentId"; var innerShipmentIdValue = innerProperties.ShipmentId; ThrowOnInconsistentIds(innerProperties, innerShipmentIdName, innerShipmentIdValue, outerShipmentIdName, outerShipmentIdValue); } }// END ThrowOnInconsistentCommands /////////////////////
public void Remove(IShipmentItemCommand c) { _innerCommands.Remove(c); }
public void Add(IShipmentItemCommand c) { _innerCommands.Add(c); }
void IShipmentItemCommands.Remove(IShipmentItemCommand c) { _innerCommands.Remove((CreateOrMergePatchOrRemoveShipmentItemDto)c); }