Example #1
0
 /// <summary> Retrieves the related entity of type 'RateEntity', 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 'RateEntity' which is related to this entity.</returns>
 public virtual RateEntity GetSingleRate(bool forceFetch)
 {
     if ((!_alreadyFetchedRate || forceFetch || _alwaysFetchRate) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool       performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.RateEntityUsingRateId);
         RateEntity newEntity          = new RateEntity();
         bool       fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.RateId.GetValueOrDefault());
         }
         if (fetchResult)
         {
             newEntity = (RateEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_rateReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Rate           = newEntity;
         _alreadyFetchedRate = fetchResult;
     }
     return(_rate);
 }
Example #2
0
 /// <summary> setups the sync logic for member _rate</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRate(IEntity relatedEntity)
 {
     if (_rate != relatedEntity)
     {
         DesetupSyncRate(true, true);
         _rate = (RateEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_rate, new PropertyChangedEventHandler(OnRatePropertyChanged), "Rate", ProductSearchEngine.RelationClasses.StaticCommentRelations.RateEntityUsingRateIdStatic, true, ref _alreadyFetchedRate, new string[] {  });
     }
 }
Example #3
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected CommentEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _product = (ProductEntity)info.GetValue("_product", typeof(ProductEntity));
            if (_product != null)
            {
                _product.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _productReturnsNewIfNotFound = info.GetBoolean("_productReturnsNewIfNotFound");
            _alwaysFetchProduct          = info.GetBoolean("_alwaysFetchProduct");
            _alreadyFetchedProduct       = info.GetBoolean("_alreadyFetchedProduct");

            _rate = (RateEntity)info.GetValue("_rate", typeof(RateEntity));
            if (_rate != null)
            {
                _rate.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _rateReturnsNewIfNotFound = info.GetBoolean("_rateReturnsNewIfNotFound");
            _alwaysFetchRate          = info.GetBoolean("_alwaysFetchRate");
            _alreadyFetchedRate       = info.GetBoolean("_alreadyFetchedRate");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
        /// <summary>Creates a new, empty RateEntity object.</summary>
        /// <returns>A new, empty RateEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new RateEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewRate
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
Example #5
0
 /// <summary> Removes the sync logic for member _rate</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 DesetupSyncRate(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_rate, new PropertyChangedEventHandler(OnRatePropertyChanged), "Rate", ProductSearchEngine.RelationClasses.StaticCommentRelations.RateEntityUsingRateIdStatic, true, signalRelatedEntity, "Comments", resetFKFields, new int[] { (int)CommentFieldIndex.RateId });
     _rate = null;
 }
 /// <summary> setups the sync logic for member _rate</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRate(IEntity relatedEntity)
 {
     if(_rate!=relatedEntity)
     {
         DesetupSyncRate(true, true);
         _rate = (RateEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _rate, new PropertyChangedEventHandler( OnRatePropertyChanged ), "Rate", ProductSearchEngine.RelationClasses.StaticCommentRelations.RateEntityUsingRateIdStatic, true, ref _alreadyFetchedRate, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _rate</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 DesetupSyncRate(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _rate, new PropertyChangedEventHandler( OnRatePropertyChanged ), "Rate", ProductSearchEngine.RelationClasses.StaticCommentRelations.RateEntityUsingRateIdStatic, true, signalRelatedEntity, "Comments", resetFKFields, new int[] { (int)CommentFieldIndex.RateId } );
     _rate = null;
 }
 /// <summary> Retrieves the related entity of type 'RateEntity', 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 'RateEntity' which is related to this entity.</returns>
 public virtual RateEntity GetSingleRate(bool forceFetch)
 {
     if( ( !_alreadyFetchedRate || forceFetch || _alwaysFetchRate) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.RateEntityUsingRateId);
         RateEntity newEntity = new RateEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.RateId.GetValueOrDefault());
         }
         if(fetchResult)
         {
             newEntity = (RateEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_rateReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Rate = newEntity;
         _alreadyFetchedRate = fetchResult;
     }
     return _rate;
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected CommentEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _product = (ProductEntity)info.GetValue("_product", typeof(ProductEntity));
            if(_product!=null)
            {
                _product.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _productReturnsNewIfNotFound = info.GetBoolean("_productReturnsNewIfNotFound");
            _alwaysFetchProduct = info.GetBoolean("_alwaysFetchProduct");
            _alreadyFetchedProduct = info.GetBoolean("_alreadyFetchedProduct");

            _rate = (RateEntity)info.GetValue("_rate", typeof(RateEntity));
            if(_rate!=null)
            {
                _rate.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _rateReturnsNewIfNotFound = info.GetBoolean("_rateReturnsNewIfNotFound");
            _alwaysFetchRate = info.GetBoolean("_alwaysFetchRate");
            _alreadyFetchedRate = info.GetBoolean("_alreadyFetchedRate");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }