public void CheckIfCanAddLineToOrder(SalesOrder order, SalesOrderLine line) { if (order.Lines.Count > 0) { throw new UserFriendlyException("订单明细太多了,不允许增加新的条目了"); } }
public void AddLine(SalesOrderLine line, ISalesOrderPolicy salesOrderPolicy) { salesOrderPolicy.CheckIfCanAddLineToOrder(this, line); this.Lines.Add(line); }