コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: MyLobin/NLayerAppV2
      /// <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;
      }
コード例 #3
0
        /// <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;
        }