/// <summary> /// Orders by Customer specification /// </summary> /// <param name="customer">The customer</param> /// <returns>Related specification for this criterion</returns> public static ISpecification<Order> OrdersByCustomer(Customer customer) { if (customer == null || customer.IsTransient()) { throw new ArgumentNullException("customer"); } return new DirectSpecification<Order>(o => o.CustomerId == customer.Id); }
/// <summary> /// Link a customer to this order line /// </summary> /// <param name="customer">The customer to relate</param> public void SetTheCustomerForThisOrder(Customer customer) { if (customer == null || customer.IsTransient()) { throw new ArgumentException(Messages.exception_CannotAssociateTransientOrNullCustomer); } this.Customer = customer; this.CustomerId = customer.Id; }
/// <summary> /// Set customer for this bank account /// </summary> /// <param name="customer"></param> public void SetCustomer(Customer customer) { if (customer == null || customer.IsTransient()) { throw new ArgumentException(Messages.exception_CannotAssociateTransientOrNullCustomer); } //fix id and set reference this.CustomerId = customer.Id; this.Customer = customer; }