public virtual void Construct(PlaceToLocationDataObject placeToLocation, bool includeDirtyObjectsOnly) { if (placeToLocation == null) { return; } this.PrimaryKey = placeToLocation.PrimaryKeysCollection; if (placeToLocation.ObjectsDataSet == null) { var dataset = ApplicationSettings.Container.Resolve <IObjectsDataSet>(); dataset.AddObject(placeToLocation); } if (placeToLocation.ObjectsDataSet == null) { _logEngine.LogError("Unable to set a dataset to the Entity PlaceToLocation", "Unable to set a dataset to the entity. Container may not be initialized", "PlaceToLocationDataObject", null); throw new PulpException("Unexpected Error : Unable to set a dataset to the entity : PlaceToLocation"); } if (placeToLocation.InternalObjectId == null) { _logEngine.LogError("Unable to construct an object without InternalObjectId in PlaceToLocationDataObject", "The Object you are trying to construct doesn't have an InternalObjectId", "PlaceToLocationDataObject", null); throw new PulpException("Unexpected Error : Unable to construct an object without InternalObjectId in PlaceToLocationDataObject"); } this.InternalObjectId = (int)placeToLocation.InternalObjectId; this.ObjectsDataSet = includeDirtyObjectsOnly ? placeToLocation.ObjectsDataSet.CloneDirtyObjects() : placeToLocation.ObjectsDataSet; }
/// <summary> /// Copy Constructor /// </summary> public PlaceToLocationDataObject(PlaceToLocationDataObject template, bool deepCopy) { this.SetLocationURIValue(template.LocationURI, false, false); this.SetPlaceURIValue(template.PlaceURI, false, false); this._location_NewObjectId = template._location_NewObjectId; this._place_NewObjectId = template._place_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 PlaceToLocationContainer(PlaceToLocationDataObject placeToLocation, bool includeDirtyObjectsOnly) { Construct(placeToLocation, includeDirtyObjectsOnly); }
public PlaceToLocationContainer(PlaceToLocationDataObject placeToLocation) { Construct(placeToLocation, false); }