/// <summary> setups the sync logic for member _phoneNumberType</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncPhoneNumberType(IEntityCore relatedEntity)
 {
     if (_phoneNumberType != relatedEntity)
     {
         DesetupSyncPhoneNumberType(true, true);
         _phoneNumberType = (PhoneNumberTypeEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_phoneNumberType, new PropertyChangedEventHandler(OnPhoneNumberTypePropertyChanged), "PhoneNumberType", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticPersonPhoneRelations.PhoneNumberTypeEntityUsingPhoneNumberTypeIdStatic, true, new string[] {  });
     }
 }
 protected PersonPhoneEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity));
         if (_person != null)
         {
             _person.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _phoneNumberType = (PhoneNumberTypeEntity)info.GetValue("_phoneNumberType", typeof(PhoneNumberTypeEntity));
         if (_phoneNumberType != null)
         {
             _phoneNumberType.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 _phoneNumberType</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncPhoneNumberType(IEntityCore relatedEntity)
		{
			if(_phoneNumberType!=relatedEntity)
			{
				DesetupSyncPhoneNumberType(true, true);
				_phoneNumberType = (PhoneNumberTypeEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _phoneNumberType, new PropertyChangedEventHandler( OnPhoneNumberTypePropertyChanged ), "PhoneNumberType", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticPersonPhoneRelations.PhoneNumberTypeEntityUsingPhoneNumberTypeIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _phoneNumberType</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 DesetupSyncPhoneNumberType(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _phoneNumberType, new PropertyChangedEventHandler( OnPhoneNumberTypePropertyChanged ), "PhoneNumberType", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticPersonPhoneRelations.PhoneNumberTypeEntityUsingPhoneNumberTypeIdStatic, true, signalRelatedEntity, "PersonPhones", resetFKFields, new int[] { (int)PersonPhoneFieldIndex.PhoneNumberTypeId } );
			_phoneNumberType = null;
		}
		protected PersonPhoneEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity));
				if(_person!=null)
				{
					_person.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_phoneNumberType = (PhoneNumberTypeEntity)info.GetValue("_phoneNumberType", typeof(PhoneNumberTypeEntity));
				if(_phoneNumberType!=null)
				{
					_phoneNumberType.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 _phoneNumberType</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 DesetupSyncPhoneNumberType(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_phoneNumberType, new PropertyChangedEventHandler(OnPhoneNumberTypePropertyChanged), "PhoneNumberType", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticPersonPhoneRelations.PhoneNumberTypeEntityUsingPhoneNumberTypeIdStatic, true, signalRelatedEntity, "PersonPhones", resetFKFields, new int[] { (int)PersonPhoneFieldIndex.PhoneNumberTypeId });
     _phoneNumberType = null;
 }