private void FixupUnitMeasure(UnitMeasure previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.BillOfMaterials.Contains(this)) { previousValue.BillOfMaterials.Remove(this); } if (UnitMeasure != null) { if (!UnitMeasure.BillOfMaterials.Contains(this)) { UnitMeasure.BillOfMaterials.Add(this); } UnitMeasureCode = UnitMeasure.UnitMeasureCode; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("UnitMeasure") && (ChangeTracker.OriginalValues["UnitMeasure"] == UnitMeasure)) { ChangeTracker.OriginalValues.Remove("UnitMeasure"); } else { ChangeTracker.RecordOriginalValue("UnitMeasure", previousValue); } if (UnitMeasure != null && !UnitMeasure.ChangeTracker.ChangeTrackingEnabled) { UnitMeasure.StartTracking(); } } }
private void FixupUnitMeasure1(UnitMeasure previousValue, bool skipKeys = false) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.Products1.Contains(this)) { previousValue.Products1.Remove(this); } if (UnitMeasure1 != null) { if (!UnitMeasure1.Products1.Contains(this)) { UnitMeasure1.Products1.Add(this); } WeightUnitMeasureCode = UnitMeasure1.UnitMeasureCode; } else if (!skipKeys) { WeightUnitMeasureCode = null; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("UnitMeasure1") && (ChangeTracker.OriginalValues["UnitMeasure1"] == UnitMeasure1)) { ChangeTracker.OriginalValues.Remove("UnitMeasure1"); } else { ChangeTracker.RecordOriginalValue("UnitMeasure1", previousValue); } if (UnitMeasure1 != null && !UnitMeasure1.ChangeTracker.ChangeTrackingEnabled) { UnitMeasure1.StartTracking(); } } }