/// <summary> Retrieves the related entity of type 'CreditCardEntity', 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 'CreditCardEntity' which is related to this entity.</returns>
 public virtual CreditCardEntity GetSingleCreditCard(bool forceFetch)
 {
     if ((!_alreadyFetchedCreditCard || forceFetch || _alwaysFetchCreditCard) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool             performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.CreditCardEntityUsingCreditCardId);
         CreditCardEntity newEntity          = new CreditCardEntity();
         bool             fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.CreditCardId);
         }
         if (fetchResult)
         {
             newEntity = (CreditCardEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_creditCardReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.CreditCard           = newEntity;
         _alreadyFetchedCreditCard = fetchResult;
     }
     return(_creditCard);
 }
 /// <summary> setups the sync logic for member _creditCard</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncCreditCard(IEntityCore relatedEntity)
 {
     if (_creditCard != relatedEntity)
     {
         DesetupSyncCreditCard(true, true);
         _creditCard = (CreditCardEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_creditCard, new PropertyChangedEventHandler(OnCreditCardPropertyChanged), "CreditCard", EPICCentralDL.RelationClasses.StaticLocationCreditCardRelations.CreditCardEntityUsingCreditCardIdStatic, true, ref _alreadyFetchedCreditCard, new string[] {  });
     }
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected LocationCreditCardEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _creditCard = (CreditCardEntity)info.GetValue("_creditCard", typeof(CreditCardEntity));
            if (_creditCard != null)
            {
                _creditCard.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _creditCardReturnsNewIfNotFound = info.GetBoolean("_creditCardReturnsNewIfNotFound");
            _alwaysFetchCreditCard          = info.GetBoolean("_alwaysFetchCreditCard");
            _alreadyFetchedCreditCard       = info.GetBoolean("_alreadyFetchedCreditCard");

            _location = (LocationEntity)info.GetValue("_location", typeof(LocationEntity));
            if (_location != null)
            {
                _location.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _locationReturnsNewIfNotFound = info.GetBoolean("_locationReturnsNewIfNotFound");
            _alwaysFetchLocation          = info.GetBoolean("_alwaysFetchLocation");
            _alreadyFetchedLocation       = info.GetBoolean("_alreadyFetchedLocation");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
 /// <summary> Removes the sync logic for member _creditCard</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 DesetupSyncCreditCard(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_creditCard, new PropertyChangedEventHandler(OnCreditCardPropertyChanged), "CreditCard", EPICCentralDL.RelationClasses.StaticLocationCreditCardRelations.CreditCardEntityUsingCreditCardIdStatic, true, signalRelatedEntity, "LocationCreditCards", resetFKFields, new int[] { (int)LocationCreditCardFieldIndex.CreditCardId });
     _creditCard = null;
 }