}// END Map(IRemove... //////////////////////////// protected virtual IOrderItemEvent Map(IOrderItemCommand c, IOrderCommand outerCommand, long version, IOrderState outerState) { var create = (c.CommandType == CommandType.Create) ? (c as ICreateOrderItem) : null; if (create != null) { return(MapCreate(create, outerCommand, version, outerState)); } var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchOrderItem) : null; if (merge != null) { return(MapMergePatch(merge, outerCommand, version, outerState)); } throw new NotSupportedException(); }
}// END ThrowOnInconsistentCommands ///////////////////// protected void ThrowOnInconsistentCommands(IOrderCommand command, IOrderItemCommand innerCommand) { var properties = command as ICreateOrMergePatchOrDeleteOrder; var innerProperties = innerCommand as ICreateOrMergePatchOrRemoveOrderItem; if (properties == null || innerProperties == null) { return; } if (innerProperties.OrderId == default(string)) { innerProperties.OrderId = properties.OrderId; } else { var outerOrderIdName = "OrderId"; var outerOrderIdValue = properties.OrderId; var innerOrderIdName = "OrderId"; var innerOrderIdValue = innerProperties.OrderId; ThrowOnInconsistentIds(innerProperties, innerOrderIdName, innerOrderIdValue, outerOrderIdName, outerOrderIdValue); } }// END ThrowOnInconsistentCommands /////////////////////
public void Remove(IOrderItemCommand c) { _innerCommands.Remove(c); }
void IOrderItemCommands.Remove(IOrderItemCommand c) { _innerCommands.Remove((CreateOrMergePatchOrRemoveOrderItemDto)c); }
public void Add(IOrderItemCommand c) { _innerCommands.Add(c); }