/// <summary> Retrieves the related entity of type 'StoreInformationEntity', 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 'StoreInformationEntity' which is related to this entity.</returns>
 public virtual StoreInformationEntity GetSingleStoreInformation(bool forceFetch)
 {
     if ((!_alreadyFetchedStoreInformation || forceFetch || _alwaysFetchStoreInformation) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool performLazyLoading          = this.CheckIfLazyLoadingShouldOccur(Relations.StoreInformationEntityUsingStoreInformationId);
         StoreInformationEntity newEntity = new StoreInformationEntity();
         bool fetchResult = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.StoreInformationId.GetValueOrDefault());
         }
         if (fetchResult)
         {
             newEntity = (StoreInformationEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_storeInformationReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.StoreInformation           = newEntity;
         _alreadyFetchedStoreInformation = fetchResult;
     }
     return(_storeInformation);
 }
 /// <summary> setups the sync logic for member _storeInformation</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncStoreInformation(IEntity relatedEntity)
 {
     if (_storeInformation != relatedEntity)
     {
         DesetupSyncStoreInformation(true, true);
         _storeInformation = (StoreInformationEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_storeInformation, new PropertyChangedEventHandler(OnStoreInformationPropertyChanged), "StoreInformation", ProductSearchEngine.RelationClasses.StaticMembershipRelations.StoreInformationEntityUsingStoreInformationIdStatic, true, ref _alreadyFetchedStoreInformation, new string[] {  });
     }
 }
 /// <summary>Private CTor for deserialization</summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected MembershipEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     _stores               = (ProductSearchEngine.CollectionClasses.StoreCollection)info.GetValue("_stores", typeof(ProductSearchEngine.CollectionClasses.StoreCollection));
     _alwaysFetchStores    = info.GetBoolean("_alwaysFetchStores");
     _alreadyFetchedStores = info.GetBoolean("_alreadyFetchedStores");
     _storeInformation     = (StoreInformationEntity)info.GetValue("_storeInformation", typeof(StoreInformationEntity));
     if (_storeInformation != null)
     {
         _storeInformation.AfterSave += new EventHandler(OnEntityAfterSave);
     }
     _storeInformationReturnsNewIfNotFound = info.GetBoolean("_storeInformationReturnsNewIfNotFound");
     _alwaysFetchStoreInformation          = info.GetBoolean("_alwaysFetchStoreInformation");
     _alreadyFetchedStoreInformation       = info.GetBoolean("_alreadyFetchedStoreInformation");
     this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
 /// <summary> Removes the sync logic for member _storeInformation</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 DesetupSyncStoreInformation(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_storeInformation, new PropertyChangedEventHandler(OnStoreInformationPropertyChanged), "StoreInformation", ProductSearchEngine.RelationClasses.StaticMembershipRelations.StoreInformationEntityUsingStoreInformationIdStatic, true, signalRelatedEntity, "Memberships", resetFKFields, new int[] { (int)MembershipFieldIndex.StoreInformationId });
     _storeInformation = null;
 }
        /// <summary>Creates a new, empty StoreInformationEntity object.</summary>
        /// <returns>A new, empty StoreInformationEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new StoreInformationEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewStoreInformation
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
 /// <summary> setups the sync logic for member _storeInformation</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncStoreInformation(IEntity relatedEntity)
 {
     if(_storeInformation!=relatedEntity)
     {
         DesetupSyncStoreInformation(true, true);
         _storeInformation = (StoreInformationEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _storeInformation, new PropertyChangedEventHandler( OnStoreInformationPropertyChanged ), "StoreInformation", ProductSearchEngine.RelationClasses.StaticMembershipRelations.StoreInformationEntityUsingStoreInformationIdStatic, true, ref _alreadyFetchedStoreInformation, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _storeInformation</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 DesetupSyncStoreInformation(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _storeInformation, new PropertyChangedEventHandler( OnStoreInformationPropertyChanged ), "StoreInformation", ProductSearchEngine.RelationClasses.StaticMembershipRelations.StoreInformationEntityUsingStoreInformationIdStatic, true, signalRelatedEntity, "Memberships", resetFKFields, new int[] { (int)MembershipFieldIndex.StoreInformationId } );
     _storeInformation = null;
 }
 /// <summary> Retrieves the related entity of type 'StoreInformationEntity', 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 'StoreInformationEntity' which is related to this entity.</returns>
 public virtual StoreInformationEntity GetSingleStoreInformation(bool forceFetch)
 {
     if( ( !_alreadyFetchedStoreInformation || forceFetch || _alwaysFetchStoreInformation) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.StoreInformationEntityUsingStoreInformationId);
         StoreInformationEntity newEntity = new StoreInformationEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.StoreInformationId.GetValueOrDefault());
         }
         if(fetchResult)
         {
             newEntity = (StoreInformationEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_storeInformationReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.StoreInformation = newEntity;
         _alreadyFetchedStoreInformation = fetchResult;
     }
     return _storeInformation;
 }
 /// <summary>Private CTor for deserialization</summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected MembershipEntity(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _stores = (ProductSearchEngine.CollectionClasses.StoreCollection)info.GetValue("_stores", typeof(ProductSearchEngine.CollectionClasses.StoreCollection));
     _alwaysFetchStores = info.GetBoolean("_alwaysFetchStores");
     _alreadyFetchedStores = info.GetBoolean("_alreadyFetchedStores");
     _storeInformation = (StoreInformationEntity)info.GetValue("_storeInformation", typeof(StoreInformationEntity));
     if(_storeInformation!=null)
     {
         _storeInformation.AfterSave+=new EventHandler(OnEntityAfterSave);
     }
     _storeInformationReturnsNewIfNotFound = info.GetBoolean("_storeInformationReturnsNewIfNotFound");
     _alwaysFetchStoreInformation = info.GetBoolean("_alwaysFetchStoreInformation");
     _alreadyFetchedStoreInformation = info.GetBoolean("_alreadyFetchedStoreInformation");
     this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }