/// <summary> setups the sync logic for member _purchaseOrderHeader</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncPurchaseOrderHeader(IEntityCore relatedEntity)
 {
     if (_purchaseOrderHeader != relatedEntity)
     {
         DesetupSyncPurchaseOrderHeader(true, true);
         _purchaseOrderHeader = (PurchaseOrderHeaderEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_purchaseOrderHeader, new PropertyChangedEventHandler(OnPurchaseOrderHeaderPropertyChanged), "PurchaseOrderHeader", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticPurchaseOrderDetailRelations.PurchaseOrderHeaderEntityUsingPurchaseOrderIdStatic, true, new string[] {  });
     }
 }
 protected PurchaseOrderDetailEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _product = (ProductEntity)info.GetValue("_product", typeof(ProductEntity));
         if (_product != null)
         {
             _product.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _purchaseOrderHeader = (PurchaseOrderHeaderEntity)info.GetValue("_purchaseOrderHeader", typeof(PurchaseOrderHeaderEntity));
         if (_purchaseOrderHeader != null)
         {
             _purchaseOrderHeader.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 _purchaseOrderHeader</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncPurchaseOrderHeader(IEntityCore relatedEntity)
		{
			if(_purchaseOrderHeader!=relatedEntity)
			{
				DesetupSyncPurchaseOrderHeader(true, true);
				_purchaseOrderHeader = (PurchaseOrderHeaderEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _purchaseOrderHeader, new PropertyChangedEventHandler( OnPurchaseOrderHeaderPropertyChanged ), "PurchaseOrderHeader", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticPurchaseOrderDetailRelations.PurchaseOrderHeaderEntityUsingPurchaseOrderIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _purchaseOrderHeader</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 DesetupSyncPurchaseOrderHeader(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _purchaseOrderHeader, new PropertyChangedEventHandler( OnPurchaseOrderHeaderPropertyChanged ), "PurchaseOrderHeader", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticPurchaseOrderDetailRelations.PurchaseOrderHeaderEntityUsingPurchaseOrderIdStatic, true, signalRelatedEntity, "PurchaseOrderDetails", resetFKFields, new int[] { (int)PurchaseOrderDetailFieldIndex.PurchaseOrderId } );
			_purchaseOrderHeader = null;
		}
		protected PurchaseOrderDetailEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_product = (ProductEntity)info.GetValue("_product", typeof(ProductEntity));
				if(_product!=null)
				{
					_product.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_purchaseOrderHeader = (PurchaseOrderHeaderEntity)info.GetValue("_purchaseOrderHeader", typeof(PurchaseOrderHeaderEntity));
				if(_purchaseOrderHeader!=null)
				{
					_purchaseOrderHeader.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 _purchaseOrderHeader</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 DesetupSyncPurchaseOrderHeader(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_purchaseOrderHeader, new PropertyChangedEventHandler(OnPurchaseOrderHeaderPropertyChanged), "PurchaseOrderHeader", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticPurchaseOrderDetailRelations.PurchaseOrderHeaderEntityUsingPurchaseOrderIdStatic, true, signalRelatedEntity, "PurchaseOrderDetails", resetFKFields, new int[] { (int)PurchaseOrderDetailFieldIndex.PurchaseOrderId });
     _purchaseOrderHeader = null;
 }