/// <summary> Retrieves the related entity of type 'OrganSystemEntity', using a relation of type 'n:1'</summary> /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param> /// <returns>A fetched entity of type 'OrganSystemEntity' which is related to this entity.</returns> public virtual OrganSystemEntity GetSingleOrganSystem(bool forceFetch) { if ((!_alreadyFetchedOrganSystem || forceFetch || _alwaysFetchOrganSystem) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.OrganSystemEntityUsingOrganSystemId); OrganSystemEntity newEntity = new OrganSystemEntity(); bool fetchResult = false; if (performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.OrganSystemId); } if (fetchResult) { newEntity = (OrganSystemEntity)GetFromActiveContext(newEntity); } else { if (!_organSystemReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.OrganSystem = newEntity; _alreadyFetchedOrganSystem = fetchResult; } return(_organSystem); }
/// <summary> setups the sync logic for member _organSystem</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncOrganSystem(IEntityCore relatedEntity) { if (_organSystem != relatedEntity) { DesetupSyncOrganSystem(true, true); _organSystem = (OrganSystemEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_organSystem, new PropertyChangedEventHandler(OnOrganSystemPropertyChanged), "OrganSystem", EPICCentralDL.RelationClasses.StaticLicenseOrganSystemRelations.OrganSystemEntityUsingOrganSystemIdStatic, true, ref _alreadyFetchedOrganSystem, new string[] { }); } }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected LicenseOrganSystemEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _organSystemOrgans = (EPICCentralDL.CollectionClasses.OrganSystemOrganCollection)info.GetValue("_organSystemOrgans", typeof(EPICCentralDL.CollectionClasses.OrganSystemOrganCollection)); _alwaysFetchOrganSystemOrgans = info.GetBoolean("_alwaysFetchOrganSystemOrgans"); _alreadyFetchedOrganSystemOrgans = info.GetBoolean("_alreadyFetchedOrganSystemOrgans"); _organSystem = (OrganSystemEntity)info.GetValue("_organSystem", typeof(OrganSystemEntity)); if (_organSystem != null) { _organSystem.AfterSave += new EventHandler(OnEntityAfterSave); } _organSystemReturnsNewIfNotFound = info.GetBoolean("_organSystemReturnsNewIfNotFound"); _alwaysFetchOrganSystem = info.GetBoolean("_alwaysFetchOrganSystem"); _alreadyFetchedOrganSystem = info.GetBoolean("_alreadyFetchedOrganSystem"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected NBAnalysisResultEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _organSystem = (OrganSystemEntity)info.GetValue("_organSystem", typeof(OrganSystemEntity)); if (_organSystem != null) { _organSystem.AfterSave += new EventHandler(OnEntityAfterSave); } _organSystemReturnsNewIfNotFound = info.GetBoolean("_organSystemReturnsNewIfNotFound"); _alwaysFetchOrganSystem = info.GetBoolean("_alwaysFetchOrganSystem"); _alreadyFetchedOrganSystem = info.GetBoolean("_alreadyFetchedOrganSystem"); _treatment = (TreatmentEntity)info.GetValue("_treatment", typeof(TreatmentEntity)); if (_treatment != null) { _treatment.AfterSave += new EventHandler(OnEntityAfterSave); } _treatmentReturnsNewIfNotFound = info.GetBoolean("_treatmentReturnsNewIfNotFound"); _alwaysFetchTreatment = info.GetBoolean("_alwaysFetchTreatment"); _alreadyFetchedTreatment = info.GetBoolean("_alreadyFetchedTreatment"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> Removes the sync logic for member _organSystem</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncOrganSystem(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_organSystem, new PropertyChangedEventHandler(OnOrganSystemPropertyChanged), "OrganSystem", EPICCentralDL.RelationClasses.StaticLicenseOrganSystemRelations.OrganSystemEntityUsingOrganSystemIdStatic, true, signalRelatedEntity, "LicenseOrganSystems", resetFKFields, new int[] { (int)LicenseOrganSystemFieldIndex.OrganSystemId }); _organSystem = null; }