/// <summary> Retrieves the related entity of type 'UserEntity', 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 'UserEntity' which is related to this entity.</returns> public virtual UserEntity GetSingleUser(bool forceFetch) { if ((!_alreadyFetchedUser || forceFetch || _alwaysFetchUser) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.UserEntityUsingUserId); UserEntity newEntity = new UserEntity(); bool fetchResult = false; if (performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.UserId); } if (fetchResult) { newEntity = (UserEntity)GetFromActiveContext(newEntity); } else { if (!_userReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.User = newEntity; _alreadyFetchedUser = fetchResult; } return(_user); }