예제 #1
0
     public bool Equals(BookingPaymentCreditCard other)
     {
         if (ReferenceEquals(null, other)) return false;
         if (ReferenceEquals(this, other)) return true;
 		if (other.CreditCardId == 0 && CreditCardId == 0)
 			return false;
 		else
 			return other.CreditCardId == CreditCardId;
     }
예제 #2
0
     private void FixupCreditCard(BookingPaymentCreditCard previousValue)
     {
         // This is the principal end in an association that performs cascade deletes.
         // Update the event listener to refer to the new dependent.
         if (previousValue != null)
         {
             ChangeTracker.ObjectStateChanging -= previousValue.HandleCascadeDelete;
         }
 
         if (CreditCard != null)
         {
             ChangeTracker.ObjectStateChanging += CreditCard.HandleCascadeDelete;
         }
 
         if (IsDeserializing)
         {
             return;
         }
 
         if (CreditCard != null)
         {
             CreditCard.CreditCardId = BookingId;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("CreditCard")
                 && (ChangeTracker.OriginalValues["CreditCard"] == CreditCard))
             {
                 ChangeTracker.OriginalValues.Remove("CreditCard");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("CreditCard", previousValue);
                 // This is the principal end of an identifying association, so the dependent must be deleted when the relationship is removed.
                 // If the current state of the dependent is Added, the relationship can be changed without causing the dependent to be deleted.
                 if (previousValue != null && previousValue.ChangeTracker.State != ObjectState.Added)
                 {
                     previousValue.MarkAsDeleted();
                 }
             }
             if (CreditCard != null && !CreditCard.ChangeTracker.ChangeTrackingEnabled)
             {
                 CreditCard.StartTracking();
             }
         }
     }