4
我们应该在哪里验证领域模型
我仍在寻找域模型验证的最佳实践。将验证放入域模型的构造函数中好吗?我的域模型验证示例如下: public class Order { private readonly List<OrderLine> _lineItems; public virtual Customer Customer { get; private set; } public virtual DateTime OrderDate { get; private set; } public virtual decimal OrderTotal { get; private set; } public Order (Customer customer) { if (customer == null) throw new ArgumentException("Customer name must …