public virtual void Construct(VisitedPlaceDataObject visitedPlace, bool includeDirtyObjectsOnly) { if (visitedPlace == null) { return; } this.PrimaryKey = visitedPlace.PrimaryKey; if (visitedPlace.ObjectsDataSet == null) { var dataset = ApplicationSettings.Container.Resolve <IObjectsDataSet>(); dataset.AddObject(visitedPlace); } if (visitedPlace.ObjectsDataSet == null) { _logEngine.LogError("Unable to set a dataset to the Entity VisitedPlace", "Unable to set a dataset to the entity. Container may not be initialized", "VisitedPlaceDataObject", null); throw new PulpException("Unexpected Error : Unable to set a dataset to the entity : VisitedPlace"); } if (visitedPlace.InternalObjectId == null) { _logEngine.LogError("Unable to construct an object without InternalObjectId in VisitedPlaceDataObject", "The Object you are trying to construct doesn't have an InternalObjectId", "VisitedPlaceDataObject", null); throw new PulpException("Unexpected Error : Unable to construct an object without InternalObjectId in VisitedPlaceDataObject"); } this.InternalObjectId = (int)visitedPlace.InternalObjectId; this.ObjectsDataSet = includeDirtyObjectsOnly ? visitedPlace.ObjectsDataSet.CloneDirtyObjects() : visitedPlace.ObjectsDataSet; }
/// <summary> /// Copy Constructor /// </summary> public VisitedPlaceDataObject(VisitedPlaceDataObject template, bool deepCopy) { this.SetDateValue(template.Date, false, false); this._date_WithTimezoneOffset = template._date_WithTimezoneOffset; this.SetCountryURIValue(template.CountryURI, false, false); this.SetDescriptionValue(template.Description, false, false); this.SetIdValue(template.Id, false, false); this.SetPlaceURIValue(template.PlaceURI, false, false); this.SetTypeofplaceValue(template.Typeofplace, false, false); this.SetUserProfileUriValue(template.UserProfileUri, false, false); this._country_NewObjectId = template._country_NewObjectId; this._place_NewObjectId = template._place_NewObjectId; this._userProfile_NewObjectId = template._userProfile_NewObjectId; this.SetIsNewValue(template.IsNew, false, false); if (deepCopy) { this.ObjectsDataSet = template.ObjectsDataSet.Clone(); // Remove the template object from the dataset this.ObjectsDataSet.RemoveObject(template); // And Replace by the one we're currently constructing this.ObjectsDataSet.AddObject(this); } this.SetIsDirtyValue(template.IsDirty, false, false); this.SetIsMarkedForDeletionValue(template.IsMarkedForDeletion, false, false); }
public VisitedPlaceContainer(VisitedPlaceDataObject visitedPlace, bool includeDirtyObjectsOnly) { Construct(visitedPlace, includeDirtyObjectsOnly); }
public VisitedPlaceContainer(VisitedPlaceDataObject visitedPlace) { Construct(visitedPlace, false); }