private Order(//多参数私有构造函数,供本领域内部使用 List <OrderProductData> orderProductsData, List <Product> allProducts, string currency, List <ConversionRate> conversionRates ) { this._orderDate = DateTime.UtcNow; this.Id = new OrderId(Guid.NewGuid()); this._orderProducts = new List <OrderProduct>(); foreach (var orderProductData in orderProductsData) { var product = allProducts.Single(t => t.Id == orderProductData.ProductId); //把订单产品的事交给OrderProduct var orderProduct = OrderProduct.CreateForProduct(product, orderProductData.Quantity, currency, conversionRates); _orderProducts.Add(orderProduct); } this.CalculateOrderValue(); this._status = OrderStatus.Placed; }
public OrderChangedEvent(OrderId orderId) { this.OrderId = orderId; }
public OrderRemovedEvent(OrderId orderId) { this.OrderId = orderId; }
public OrderPlacedEvent(OrderId orderId) { OrderId = orderId; }