/// <summary> Retrieves the related entity of type 'CustomerDemographyEntity', 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 'CustomerDemographyEntity' which is related to this entity.</returns>
 public virtual CustomerDemographyEntity GetSingleCustomerDemography(bool forceFetch)
 {
     if ((!_alreadyFetchedCustomerDemography || forceFetch || _alwaysFetchCustomerDemography) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool performLazyLoading            = this.CheckIfLazyLoadingShouldOccur(Relations.CustomerDemographyEntityUsingCustomerTypeId);
         CustomerDemographyEntity newEntity = new CustomerDemographyEntity();
         bool fetchResult = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.CustomerTypeId);
         }
         if (fetchResult)
         {
             newEntity = (CustomerDemographyEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_customerDemographyReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.CustomerDemography           = newEntity;
         _alreadyFetchedCustomerDemography = fetchResult;
     }
     return(_customerDemography);
 }
Beispiel #2
0
 /// <summary> setups the sync logic for member _customerDemography</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncCustomerDemography(IEntityCore relatedEntity)
 {
     if (_customerDemography != relatedEntity)
     {
         DesetupSyncCustomerDemography(true, true);
         _customerDemography = (CustomerDemographyEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_customerDemography, new PropertyChangedEventHandler(OnCustomerDemographyPropertyChanged), "CustomerDemography", SD.LLBLGen.Pro.Examples.RelationClasses.StaticCustomerCustomerDemoRelations.CustomerDemographyEntityUsingCustomerTypeIdStatic, true, new string[] {  });
     }
 }
Beispiel #3
0
 protected CustomerCustomerDemoEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _customer = (CustomerEntity)info.GetValue("_customer", typeof(CustomerEntity));
         if (_customer != null)
         {
             _customer.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _customerDemography = (CustomerDemographyEntity)info.GetValue("_customerDemography", typeof(CustomerDemographyEntity));
         if (_customerDemography != null)
         {
             _customerDemography.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected CustomerCustomerDemoEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _customer = (CustomerEntity)info.GetValue("_customer", typeof(CustomerEntity));
            if (_customer != null)
            {
                _customer.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _customerReturnsNewIfNotFound = info.GetBoolean("_customerReturnsNewIfNotFound");
            _alwaysFetchCustomer          = info.GetBoolean("_alwaysFetchCustomer");
            _alreadyFetchedCustomer       = info.GetBoolean("_alreadyFetchedCustomer");

            _customerDemography = (CustomerDemographyEntity)info.GetValue("_customerDemography", typeof(CustomerDemographyEntity));
            if (_customerDemography != null)
            {
                _customerDemography.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _customerDemographyReturnsNewIfNotFound = info.GetBoolean("_customerDemographyReturnsNewIfNotFound");
            _alwaysFetchCustomerDemography          = info.GetBoolean("_alwaysFetchCustomerDemography");
            _alreadyFetchedCustomerDemography       = info.GetBoolean("_alreadyFetchedCustomerDemography");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Beispiel #5
0
 /// <summary> Removes the sync logic for member _customerDemography</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 DesetupSyncCustomerDemography(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_customerDemography, new PropertyChangedEventHandler(OnCustomerDemographyPropertyChanged), "CustomerDemography", SD.LLBLGen.Pro.Examples.RelationClasses.StaticCustomerCustomerDemoRelations.CustomerDemographyEntityUsingCustomerTypeIdStatic, true, signalRelatedEntity, "CustomerCustomerDemo", resetFKFields, new int[] { (int)CustomerCustomerDemoFieldIndex.CustomerTypeId });
     _customerDemography = null;
 }