/// <summary> setups the sync logic for member _contactType</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncContactType(IEntityCore relatedEntity)
 {
     if (_contactType != relatedEntity)
     {
         DesetupSyncContactType(true, true);
         _contactType = (ContactTypeEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_contactType, new PropertyChangedEventHandler(OnContactTypePropertyChanged), "ContactType", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticBusinessEntityContactRelations.ContactTypeEntityUsingContactTypeIdStatic, true, new string[] {  });
     }
 }
 protected BusinessEntityContactEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _businessEntity = (BusinessEntityEntity)info.GetValue("_businessEntity", typeof(BusinessEntityEntity));
         if (_businessEntity != null)
         {
             _businessEntity.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _contactType = (ContactTypeEntity)info.GetValue("_contactType", typeof(ContactTypeEntity));
         if (_contactType != null)
         {
             _contactType.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity));
         if (_person != null)
         {
             _person.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 _contactType</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncContactType(IEntityCore relatedEntity)
		{
			if(_contactType!=relatedEntity)
			{
				DesetupSyncContactType(true, true);
				_contactType = (ContactTypeEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _contactType, new PropertyChangedEventHandler( OnContactTypePropertyChanged ), "ContactType", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticVendorContactRelations.ContactTypeEntityUsingContactTypeIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _contactType</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 DesetupSyncContactType(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _contactType, new PropertyChangedEventHandler( OnContactTypePropertyChanged ), "ContactType", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticVendorContactRelations.ContactTypeEntityUsingContactTypeIdStatic, true, signalRelatedEntity, "VendorContacts", resetFKFields, new int[] { (int)VendorContactFieldIndex.ContactTypeId } );
			_contactType = null;
		}
		protected VendorContactEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_contact = (ContactEntity)info.GetValue("_contact", typeof(ContactEntity));
				if(_contact!=null)
				{
					_contact.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_contactType = (ContactTypeEntity)info.GetValue("_contactType", typeof(ContactTypeEntity));
				if(_contactType!=null)
				{
					_contactType.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_vendor = (VendorEntity)info.GetValue("_vendor", typeof(VendorEntity));
				if(_vendor!=null)
				{
					_vendor.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
			
		}
		protected BusinessEntityContactEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_businessEntity = (BusinessEntityEntity)info.GetValue("_businessEntity", typeof(BusinessEntityEntity));
				if(_businessEntity!=null)
				{
					_businessEntity.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_contactType = (ContactTypeEntity)info.GetValue("_contactType", typeof(ContactTypeEntity));
				if(_contactType!=null)
				{
					_contactType.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_person = (PersonEntity)info.GetValue("_person", typeof(PersonEntity));
				if(_person!=null)
				{
					_person.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 _contactType</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 DesetupSyncContactType(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_contactType, new PropertyChangedEventHandler(OnContactTypePropertyChanged), "ContactType", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticBusinessEntityContactRelations.ContactTypeEntityUsingContactTypeIdStatic, true, signalRelatedEntity, "BusinessEntityContacts", resetFKFields, new int[] { (int)BusinessEntityContactFieldIndex.ContactTypeId });
     _contactType = null;
 }