Ejemplo n.º 1
0
 /// <summary> Retrieves the related entity of type 'MembershipEntity', 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 'MembershipEntity' which is related to this entity.</returns>
 public virtual MembershipEntity GetSingleMembership(bool forceFetch)
 {
     if ((!_alreadyFetchedMembership || forceFetch || _alwaysFetchMembership) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool             performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.MembershipEntityUsingMembershipId);
         MembershipEntity newEntity          = new MembershipEntity();
         bool             fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.MembershipId.GetValueOrDefault());
         }
         if (fetchResult)
         {
             newEntity = (MembershipEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_membershipReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Membership           = newEntity;
         _alreadyFetchedMembership = fetchResult;
     }
     return(_membership);
 }
 /// <summary> Retrieves the related entity of type 'MembershipEntity', 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 'MembershipEntity' which is related to this entity.</returns>
 public virtual MembershipEntity GetSingleMembership(bool forceFetch)
 {
     if( ( !_alreadyFetchedMembership || forceFetch || _alwaysFetchMembership) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.MembershipEntityUsingMembershipId);
         MembershipEntity newEntity = new MembershipEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.MembershipId.GetValueOrDefault());
         }
         if(fetchResult)
         {
             newEntity = (MembershipEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_membershipReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Membership = newEntity;
         _alreadyFetchedMembership = fetchResult;
     }
     return _membership;
 }