Exemplo n.º 1
0
     private void FixupAddress(BookingPaymentCreditCardAddress 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 (Address != null)
         {
             ChangeTracker.ObjectStateChanging += Address.HandleCascadeDelete;
         }
 
         if (IsDeserializing)
         {
             return;
         }
 
         if (Address != null)
         {
             Address.CreditCardId = CreditCardId;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("Address")
                 && (ChangeTracker.OriginalValues["Address"] == Address))
             {
                 ChangeTracker.OriginalValues.Remove("Address");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("Address", 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 (Address != null && !Address.ChangeTracker.ChangeTrackingEnabled)
             {
                 Address.StartTracking();
             }
         }
     }
     public bool Equals(BookingPaymentCreditCardAddress 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;
     }