/// <summary> /// Returns true if self and the provided entity have the same Id values /// and the Ids are not of the default Id value /// </summary> protected bool HasSameNonDefaultIdAs(EuTravelDiaryPOIDTO compareTo) { return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id)); }
/// <summary> /// Copies the current object to a new instance /// </summary> /// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param> /// <param name="copiedObjects">Objects that should be reused</param> /// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param> /// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param> /// <param name="copy">Optional - An existing [EuTravelDiaryPOIDTO] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual EuTravelDiaryPOIDTO Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, EuTravelDiaryPOIDTO copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((EuTravelDiaryPOIDTO)copiedObjects[this]); } copy = copy ?? new EuTravelDiaryPOIDTO(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.IsPublic = this.IsPublic; copy.Name = this.Name; copy.Description = this.Description; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } copy.euTravelDiaryPhotographDTO = new List <EuTravelDiaryPhotographDTO>(); if (deep && this.euTravelDiaryPhotographDTO != null) { foreach (var __item in this.euTravelDiaryPhotographDTO) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddEuTravelDiaryPhotographDTO(__item); } else { copy.AddEuTravelDiaryPhotographDTO(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddEuTravelDiaryPhotographDTO((EuTravelDiaryPhotographDTO)copiedObjects[__item]); } } } copy.euTravelDiaryNoteDTO = new List <EuTravelDiaryNoteDTO>(); if (deep && this.euTravelDiaryNoteDTO != null) { foreach (var __item in this.euTravelDiaryNoteDTO) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddEuTravelDiaryNoteDTO(__item); } else { copy.AddEuTravelDiaryNoteDTO(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddEuTravelDiaryNoteDTO((EuTravelDiaryNoteDTO)copiedObjects[__item]); } } } if (deep && this.euTravelDiaryGeoCoordinatesDTO != null) { if (!copiedObjects.Contains(this.euTravelDiaryGeoCoordinatesDTO)) { if (asNew && reuseNestedObjects) { copy.EuTravelDiaryGeoCoordinatesDTO = this.EuTravelDiaryGeoCoordinatesDTO; } else if (asNew) { copy.EuTravelDiaryGeoCoordinatesDTO = this.EuTravelDiaryGeoCoordinatesDTO.Copy(deep, copiedObjects, true); } else { copy.euTravelDiaryGeoCoordinatesDTO = this.euTravelDiaryGeoCoordinatesDTO.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.EuTravelDiaryGeoCoordinatesDTO = (EuTravelDiaryGeoCoordinatesDTO)copiedObjects[this.EuTravelDiaryGeoCoordinatesDTO]; } else { copy.euTravelDiaryGeoCoordinatesDTO = (EuTravelDiaryGeoCoordinatesDTO)copiedObjects[this.EuTravelDiaryGeoCoordinatesDTO]; } } } return(copy); }