示例#1
0
 /// <summary> setups the sync logic for member _stateProvince</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncStateProvince(IEntity relatedEntity)
 {
     if (_stateProvince != relatedEntity)
     {
         DesetupSyncStateProvince(true, true);
         _stateProvince = (StateProvinceEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_stateProvince, new PropertyChangedEventHandler(OnStateProvincePropertyChanged), "StateProvince", SalesTaxRateEntity.Relations.StateProvinceEntityUsingStateProvinceID, true, ref _alreadyFetchedStateProvince, new string[] {  });
     }
 }
示例#2
0
        /// <summary> Initializes the class members</summary>
        private void InitClassMembers()
        {
            _stateProvince = null;
            _stateProvinceReturnsNewIfNotFound = true;
            _alwaysFetchStateProvince          = false;
            _alreadyFetchedStateProvince       = false;


            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END

            OnInitClassMembersComplete();
        }
示例#3
0
        /// <summary>Protected CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected SalesTaxRateEntityBase(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _stateProvince = (StateProvinceEntity)info.GetValue("_stateProvince", typeof(StateProvinceEntity));
            if (_stateProvince != null)
            {
                _stateProvince.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _stateProvinceReturnsNewIfNotFound = info.GetBoolean("_stateProvinceReturnsNewIfNotFound");
            _alwaysFetchStateProvince          = info.GetBoolean("_alwaysFetchStateProvince");
            _alreadyFetchedStateProvince       = info.GetBoolean("_alreadyFetchedStateProvince");

            base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
示例#4
0
        /// <summary> Retrieves the related entity of type 'StateProvinceEntity', 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 'StateProvinceEntity' which is related to this entity.</returns>
        public virtual StateProvinceEntity GetSingleStateProvince(bool forceFetch)
        {
            if ((!_alreadyFetchedStateProvince || forceFetch || _alwaysFetchStateProvince) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
            {
                bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(SalesTaxRateEntity.Relations.StateProvinceEntityUsingStateProvinceID);

                StateProvinceEntity newEntity = new StateProvinceEntity();
                if (base.ParticipatesInTransaction)
                {
                    base.Transaction.Add(newEntity);
                }
                bool fetchResult = false;
                if (performLazyLoading)
                {
                    fetchResult = newEntity.FetchUsingPK(this.StateProvinceID);
                }
                if (fetchResult)
                {
                    if (base.ActiveContext != null)
                    {
                        newEntity = (StateProvinceEntity)base.ActiveContext.Get(newEntity);
                    }
                    this.StateProvince = newEntity;
                }
                else
                {
                    if (_stateProvinceReturnsNewIfNotFound)
                    {
                        if (performLazyLoading || (!performLazyLoading && (_stateProvince == null)))
                        {
                            this.StateProvince = newEntity;
                        }
                    }
                    else
                    {
                        this.StateProvince = null;
                    }
                }
                _alreadyFetchedStateProvince = fetchResult;
                if (base.ParticipatesInTransaction && !fetchResult)
                {
                    base.Transaction.Remove(newEntity);
                }
            }
            return(_stateProvince);
        }
示例#5
0
 /// <summary> Removes the sync logic for member _stateProvince</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 DesetupSyncStateProvince(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_stateProvince, new PropertyChangedEventHandler(OnStateProvincePropertyChanged), "StateProvince", SalesTaxRateEntity.Relations.StateProvinceEntityUsingStateProvinceID, true, signalRelatedEntity, "SalesTaxRate", resetFKFields, new int[] { (int)SalesTaxRateFieldIndex.StateProvinceID });
     _stateProvince = null;
 }