Example #1
0
 /// <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 GetSingleCustomerDemographics(bool forceFetch)
 {
     if ((!_alreadyFetchedCustomerDemographics || forceFetch || _alwaysFetchCustomerDemographics) && !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 (!_customerDemographicsReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.CustomerDemographics           = newEntity;
         _alreadyFetchedCustomerDemographics = fetchResult;
     }
     return(_customerDemographics);
 }
Example #2
0
 /// <summary> setups the sync logic for member _customerDemographics</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncCustomerDemographics(IEntityCore relatedEntity)
 {
     if (_customerDemographics != relatedEntity)
     {
         DesetupSyncCustomerDemographics(true, true);
         _customerDemographics = (CustomerDemographyEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_customerDemographics, new PropertyChangedEventHandler(OnCustomerDemographicsPropertyChanged), "CustomerDemographics", SD.LLBLGen.Pro.Examples.Auditing.RelationClasses.StaticCustomerCustomerDemoRelations.CustomerDemographyEntityUsingCustomerTypeIdStatic, true, new string[] {  });
     }
 }
Example #3
0
 protected CustomerCustomerDemoEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _customers = (CustomerEntity)info.GetValue("_customers", typeof(CustomerEntity));
         if (_customers != null)
         {
             _customers.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _customerDemographics = (CustomerDemographyEntity)info.GetValue("_customerDemographics", typeof(CustomerDemographyEntity));
         if (_customerDemographics != null)
         {
             _customerDemographics.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
Example #4
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected CustomerCustomerDemoEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _customers = (CustomerEntity)info.GetValue("_customers", typeof(CustomerEntity));
            if (_customers != null)
            {
                _customers.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _customersReturnsNewIfNotFound = info.GetBoolean("_customersReturnsNewIfNotFound");
            _alwaysFetchCustomers          = info.GetBoolean("_alwaysFetchCustomers");
            _alreadyFetchedCustomers       = info.GetBoolean("_alreadyFetchedCustomers");

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