/// <summary> Retrieves the related entity of type 'AccountRestrictionEntity', 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 'AccountRestrictionEntity' which is related to this entity.</returns> public virtual AccountRestrictionEntity GetSingleAccountRestriction(bool forceFetch) { if ((!_alreadyFetchedAccountRestriction || forceFetch || _alwaysFetchAccountRestriction) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.AccountRestrictionEntityUsingAccountRestrictionId); AccountRestrictionEntity newEntity = new AccountRestrictionEntity(); bool fetchResult = false; if (performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.AccountRestrictionId); } if (fetchResult) { newEntity = (AccountRestrictionEntity)GetFromActiveContext(newEntity); } else { if (!_accountRestrictionReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.AccountRestriction = newEntity; _alreadyFetchedAccountRestriction = fetchResult; } return(_accountRestriction); }
/// <summary> setups the sync logic for member _accountRestriction</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncAccountRestriction(IEntityCore relatedEntity) { if (_accountRestriction != relatedEntity) { DesetupSyncAccountRestriction(true, true); _accountRestriction = (AccountRestrictionEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_accountRestriction, new PropertyChangedEventHandler(OnAccountRestrictionPropertyChanged), "AccountRestriction", EPICCentralDL.RelationClasses.StaticUserAccountRestrictionRelations.AccountRestrictionEntityUsingAccountRestrictionIdStatic, true, ref _alreadyFetchedAccountRestriction, new string[] { }); } }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected UserAccountRestrictionEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _accountRestriction = (AccountRestrictionEntity)info.GetValue("_accountRestriction", typeof(AccountRestrictionEntity)); if (_accountRestriction != null) { _accountRestriction.AfterSave += new EventHandler(OnEntityAfterSave); } _accountRestrictionReturnsNewIfNotFound = info.GetBoolean("_accountRestrictionReturnsNewIfNotFound"); _alwaysFetchAccountRestriction = info.GetBoolean("_alwaysFetchAccountRestriction"); _alreadyFetchedAccountRestriction = info.GetBoolean("_alreadyFetchedAccountRestriction"); _user = (UserEntity)info.GetValue("_user", typeof(UserEntity)); if (_user != null) { _user.AfterSave += new EventHandler(OnEntityAfterSave); } _userReturnsNewIfNotFound = info.GetBoolean("_userReturnsNewIfNotFound"); _alwaysFetchUser = info.GetBoolean("_alwaysFetchUser"); _alreadyFetchedUser = info.GetBoolean("_alreadyFetchedUser"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> Removes the sync logic for member _accountRestriction</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 DesetupSyncAccountRestriction(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_accountRestriction, new PropertyChangedEventHandler(OnAccountRestrictionPropertyChanged), "AccountRestriction", EPICCentralDL.RelationClasses.StaticUserAccountRestrictionRelations.AccountRestrictionEntityUsingAccountRestrictionIdStatic, true, signalRelatedEntity, "UserAccountRestrictions", resetFKFields, new int[] { (int)UserAccountRestrictionFieldIndex.AccountRestrictionId }); _accountRestriction = null; }