예제 #1
0
 /// <summary> Retrieves the related entity of type 'ThreadEntity', 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 'ThreadEntity' which is related to this entity.</returns>
 public virtual ThreadEntity GetSingleThread(bool forceFetch)
 {
     if ((!_alreadyFetchedThread || forceFetch || _alwaysFetchThread) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool         performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.ThreadEntityUsingThreadID);
         ThreadEntity newEntity          = new ThreadEntity();
         bool         fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.ThreadID);
         }
         if (fetchResult)
         {
             newEntity = (ThreadEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_threadReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Thread           = newEntity;
         _alreadyFetchedThread = fetchResult;
     }
     return(_thread);
 }
예제 #2
0
 /// <summary> setups the sync logic for member _thread</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncThread(IEntityCore relatedEntity)
 {
     if (_thread != relatedEntity)
     {
         DesetupSyncThread(true, true);
         _thread = (ThreadEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_thread, new PropertyChangedEventHandler(OnThreadPropertyChanged), "Thread", SD.HnD.DAL.RelationClasses.StaticBookmarkRelations.ThreadEntityUsingThreadIDStatic, true, ref _alreadyFetchedThread, new string[] {  });
     }
 }
 /// <summary>Private CTor for deserialization</summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected AuditDataThreadRelatedEntityBase(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     _thread = (ThreadEntity)info.GetValue("_thread", typeof(ThreadEntity));
     if (_thread != null)
     {
         _thread.AfterSave += new EventHandler(OnEntityAfterSave);
     }
     _threadReturnsNewIfNotFound = info.GetBoolean("_threadReturnsNewIfNotFound");
     _alwaysFetchThread          = info.GetBoolean("_alwaysFetchThread");
     _alreadyFetchedThread       = info.GetBoolean("_alreadyFetchedThread");
     this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
예제 #4
0
 /// <summary> Removes the sync logic for member _thread</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 DesetupSyncThread(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_thread, new PropertyChangedEventHandler(OnThreadPropertyChanged), "Thread", SD.HnD.DAL.RelationClasses.StaticBookmarkRelations.ThreadEntityUsingThreadIDStatic, true, signalRelatedEntity, "PresentInBookmarks", resetFKFields, new int[] { (int)BookmarkFieldIndex.ThreadID });
     _thread = null;
 }