Ejemplo n.º 1
0
 /// <summary> Retrieves the related entity of type 'FeedEntity', 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 'FeedEntity' which is related to this entity.</returns>
 public virtual FeedEntity GetSingleFeed(bool forceFetch)
 {
     if ((!_alreadyFetchedFeed || forceFetch || _alwaysFetchFeed) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool       performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.FeedEntityUsingFeedGuid);
         FeedEntity newEntity          = new FeedEntity();
         bool       fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.FeedGuid);
         }
         if (fetchResult)
         {
             newEntity = (FeedEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_feedReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Feed           = newEntity;
         _alreadyFetchedFeed = fetchResult;
     }
     return(_feed);
 }
Ejemplo n.º 2
0
 /// <summary> setups the sync logic for member _feed</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncFeed(IEntityCore relatedEntity)
 {
     if (_feed != relatedEntity)
     {
         DesetupSyncFeed(true, true);
         _feed = (FeedEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_feed, new PropertyChangedEventHandler(OnFeedPropertyChanged), "Feed", SquawkTalk.Datalayer.RelationClasses.StaticResponseRelations.FeedEntityUsingFeedGuidStatic, true, ref _alreadyFetchedFeed, new string[] {  });
     }
 }
Ejemplo n.º 3
0
 /// <summary>Private CTor for deserialization</summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected ResponseEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     _feed = (FeedEntity)info.GetValue("_feed", typeof(FeedEntity));
     if (_feed != null)
     {
         _feed.AfterSave += new EventHandler(OnEntityAfterSave);
     }
     _feedReturnsNewIfNotFound = info.GetBoolean("_feedReturnsNewIfNotFound");
     _alwaysFetchFeed          = info.GetBoolean("_alwaysFetchFeed");
     _alreadyFetchedFeed       = info.GetBoolean("_alreadyFetchedFeed");
     this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
Ejemplo n.º 4
0
 /// <summary> Removes the sync logic for member _feed</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 DesetupSyncFeed(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_feed, new PropertyChangedEventHandler(OnFeedPropertyChanged), "Feed", SquawkTalk.Datalayer.RelationClasses.StaticResponseRelations.FeedEntityUsingFeedGuidStatic, true, signalRelatedEntity, "Responses", resetFKFields, new int[] { (int)ResponseFieldIndex.FeedGuid });
     _feed = null;
 }