private void FixupProductTitle1(ProductTitle previousValue) { if (IsDeserializing) { return; } if (previousValue != null && ReferenceEquals(previousValue.ProductTitles1, this)) { previousValue.ProductTitles1 = null; } if (ProductTitle1 != null) { ProductTitle1.ProductTitles1 = this; ProductTitleId = ProductTitle1.ProductTitleId; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("ProductTitle1") && (ChangeTracker.OriginalValues["ProductTitle1"] == ProductTitle1)) { ChangeTracker.OriginalValues.Remove("ProductTitle1"); } else { ChangeTracker.RecordOriginalValue("ProductTitle1", previousValue); } if (ProductTitle1 != null && !ProductTitle1.ChangeTracker.ChangeTrackingEnabled) { ProductTitle1.StartTracking(); } } }
private void FixupProductTitles1(ProductTitle 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 (ProductTitles1 != null) { ChangeTracker.ObjectStateChanging += ProductTitles1.HandleCascadeDelete; } if (IsDeserializing) { return; } if (previousValue != null && ReferenceEquals(previousValue.ProductTitle1, this)) { previousValue.ProductTitle1 = null; } if (ProductTitles1 != null) { ProductTitles1.ProductTitle1 = this; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("ProductTitles1") && (ChangeTracker.OriginalValues["ProductTitles1"] == ProductTitles1)) { ChangeTracker.OriginalValues.Remove("ProductTitles1"); } else { ChangeTracker.RecordOriginalValue("ProductTitles1", 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 (ProductTitles1 != null && !ProductTitles1.ChangeTracker.ChangeTrackingEnabled) { ProductTitles1.StartTracking(); } } }
private void FixupProductTitle(ProductTitle previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.Products.Contains(this)) { previousValue.Products.Remove(this); } if (ProductTitle != null) { if (!ProductTitle.Products.Contains(this)) { ProductTitle.Products.Add(this); } } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("ProductTitle") && (ChangeTracker.OriginalValues["ProductTitle"] == ProductTitle)) { ChangeTracker.OriginalValues.Remove("ProductTitle"); } else { ChangeTracker.RecordOriginalValue("ProductTitle", previousValue); } if (ProductTitle != null && !ProductTitle.ChangeTracker.ChangeTrackingEnabled) { ProductTitle.StartTracking(); } FixupProductTitleKeys(); } }