public static Car GetEntity(this CarPrimitive primitive) { Car result = new Car(); result.Id = primitive.Id; result.RegistrationNumber = primitive.RegistrationNumber; result.Name = primitive.Name; result.InternalName = primitive.InternalName; result.CarType = primitive.CarType; result.Deleted = primitive.Deleted; result.Capacity = primitive.Capacity; result.TransportType = primitive.TransportType; result.Driver_Id = primitive.Driver_Id; result.Deactivated = primitive.Deactivated; return result; }
private void FixupCar(Car previousValue) { if (previousValue != null && ReferenceEquals(previousValue.CarType, this)) { previousValue.CarType = null; } if (Car != null) { Car.CarType = this; if (Id != Car.Id) { Id = Car.Id; } } }
private void FixupCar(Car previousValue) { if (previousValue != null && previousValue.DeliveryNotes.Contains(this)) { previousValue.DeliveryNotes.Remove(this); } if (Car != null) { if (!Car.DeliveryNotes.Contains(this)) { Car.DeliveryNotes.Add(this); } if (Car_Id != Car.Id) { Car_Id = Car.Id; } } else if (!_settingFK) { Car_Id = null; } }