/// <summary> Retrieves the related entity of type 'LicenseOrganSystemEntity', 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 'LicenseOrganSystemEntity' which is related to this entity.</returns> public virtual LicenseOrganSystemEntity GetSingleLicenseOrganSystem(bool forceFetch) { if ((!_alreadyFetchedLicenseOrganSystem || forceFetch || _alwaysFetchLicenseOrganSystem) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.LicenseOrganSystemEntityUsingLicenseOrganSystemId); LicenseOrganSystemEntity newEntity = new LicenseOrganSystemEntity(); bool fetchResult = false; if (performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.LicenseOrganSystemId); } if (fetchResult) { newEntity = (LicenseOrganSystemEntity)GetFromActiveContext(newEntity); } else { if (!_licenseOrganSystemReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.LicenseOrganSystem = newEntity; _alreadyFetchedLicenseOrganSystem = fetchResult; } return(_licenseOrganSystem); }
/// <summary> setups the sync logic for member _licenseOrganSystem</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncLicenseOrganSystem(IEntityCore relatedEntity) { if (_licenseOrganSystem != relatedEntity) { DesetupSyncLicenseOrganSystem(true, true); _licenseOrganSystem = (LicenseOrganSystemEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_licenseOrganSystem, new PropertyChangedEventHandler(OnLicenseOrganSystemPropertyChanged), "LicenseOrganSystem", EPICCentralDL.RelationClasses.StaticOrganSystemOrganRelations.LicenseOrganSystemEntityUsingLicenseOrganSystemIdStatic, true, ref _alreadyFetchedLicenseOrganSystem, new string[] { }); } }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected OrganSystemOrganEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _licenseOrganSystem = (LicenseOrganSystemEntity)info.GetValue("_licenseOrganSystem", typeof(LicenseOrganSystemEntity)); if (_licenseOrganSystem != null) { _licenseOrganSystem.AfterSave += new EventHandler(OnEntityAfterSave); } _licenseOrganSystemReturnsNewIfNotFound = info.GetBoolean("_licenseOrganSystemReturnsNewIfNotFound"); _alwaysFetchLicenseOrganSystem = info.GetBoolean("_alwaysFetchLicenseOrganSystem"); _alreadyFetchedLicenseOrganSystem = info.GetBoolean("_alreadyFetchedLicenseOrganSystem"); _organ = (OrganEntity)info.GetValue("_organ", typeof(OrganEntity)); if (_organ != null) { _organ.AfterSave += new EventHandler(OnEntityAfterSave); } _organReturnsNewIfNotFound = info.GetBoolean("_organReturnsNewIfNotFound"); _alwaysFetchOrgan = info.GetBoolean("_alwaysFetchOrgan"); _alreadyFetchedOrgan = info.GetBoolean("_alreadyFetchedOrgan"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> Removes the sync logic for member _licenseOrganSystem</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 DesetupSyncLicenseOrganSystem(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_licenseOrganSystem, new PropertyChangedEventHandler(OnLicenseOrganSystemPropertyChanged), "LicenseOrganSystem", EPICCentralDL.RelationClasses.StaticOrganSystemOrganRelations.LicenseOrganSystemEntityUsingLicenseOrganSystemIdStatic, true, signalRelatedEntity, "OrganSystemOrgans", resetFKFields, new int[] { (int)OrganSystemOrganFieldIndex.LicenseOrganSystemId }); _licenseOrganSystem = null; }