/// <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(IEntityCore relatedEntity)
 {
     if (_stateProvince != relatedEntity)
     {
         DesetupSyncStateProvince(true, true);
         _stateProvince = (StateProvinceEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_stateProvince, new PropertyChangedEventHandler(OnStateProvincePropertyChanged), "StateProvince", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticAddressRelations.StateProvinceEntityUsingStateProvinceIdStatic, true, new string[] {  });
     }
 }
 protected SalesTaxRateEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _stateProvince = (StateProvinceEntity)info.GetValue("_stateProvince", typeof(StateProvinceEntity));
         if (_stateProvince != null)
         {
             _stateProvince.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
 protected AddressEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _businessEntityAddresses = (EntityCollection <BusinessEntityAddressEntity>)info.GetValue("_businessEntityAddresses", typeof(EntityCollection <BusinessEntityAddressEntity>));
         _salesOrderHeaders       = (EntityCollection <SalesOrderHeaderEntity>)info.GetValue("_salesOrderHeaders", typeof(EntityCollection <SalesOrderHeaderEntity>));
         _salesOrderHeaders_      = (EntityCollection <SalesOrderHeaderEntity>)info.GetValue("_salesOrderHeaders_", typeof(EntityCollection <SalesOrderHeaderEntity>));
         _stateProvince           = (StateProvinceEntity)info.GetValue("_stateProvince", typeof(StateProvinceEntity));
         if (_stateProvince != null)
         {
             _stateProvince.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
		/// <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(IEntityCore relatedEntity)
		{
			if(_stateProvince!=relatedEntity)
			{
				DesetupSyncStateProvince(true, true);
				_stateProvince = (StateProvinceEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _stateProvince, new PropertyChangedEventHandler( OnStateProvincePropertyChanged ), "StateProvince", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticAddressRelations.StateProvinceEntityUsingStateProvinceIdStatic, true, new string[] {  } );
			}
		}
		/// <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)
		{
			this.PerformDesetupSyncRelatedEntity( _stateProvince, new PropertyChangedEventHandler( OnStateProvincePropertyChanged ), "StateProvince", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticAddressRelations.StateProvinceEntityUsingStateProvinceIdStatic, true, signalRelatedEntity, "Addresses", resetFKFields, new int[] { (int)AddressFieldIndex.StateProvinceId } );
			_stateProvince = null;
		}
		protected AddressEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_businessEntityAddresses = (EntityCollection<BusinessEntityAddressEntity>)info.GetValue("_businessEntityAddresses", typeof(EntityCollection<BusinessEntityAddressEntity>));
				_salesOrderHeaders = (EntityCollection<SalesOrderHeaderEntity>)info.GetValue("_salesOrderHeaders", typeof(EntityCollection<SalesOrderHeaderEntity>));
				_salesOrderHeaders_ = (EntityCollection<SalesOrderHeaderEntity>)info.GetValue("_salesOrderHeaders_", typeof(EntityCollection<SalesOrderHeaderEntity>));
				_stateProvince = (StateProvinceEntity)info.GetValue("_stateProvince", typeof(StateProvinceEntity));
				if(_stateProvince!=null)
				{
					_stateProvince.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}
 /// <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)
 {
     this.PerformDesetupSyncRelatedEntity(_stateProvince, new PropertyChangedEventHandler(OnStateProvincePropertyChanged), "StateProvince", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticAddressRelations.StateProvinceEntityUsingStateProvinceIdStatic, true, signalRelatedEntity, "Addresses", resetFKFields, new int[] { (int)AddressFieldIndex.StateProvinceId });
     _stateProvince = null;
 }
		protected SalesTaxRateEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_stateProvince = (StateProvinceEntity)info.GetValue("_stateProvince", typeof(StateProvinceEntity));
				if(_stateProvince!=null)
				{
					_stateProvince.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}