/// <summary> Removes the sync logic for member _salesOrderHeader</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 DesetupSyncSalesOrderHeader(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _salesOrderHeader, new PropertyChangedEventHandler( OnSalesOrderHeaderPropertyChanged ), "SalesOrderHeader", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticSalesOrderHeaderSalesReasonRelations.SalesOrderHeaderEntityUsingSalesOrderIdStatic, true, signalRelatedEntity, "SalesOrderHeaderSalesReasons", resetFKFields, new int[] { (int)SalesOrderHeaderSalesReasonFieldIndex.SalesOrderId } );
			_salesOrderHeader = null;
		}
		/// <summary> setups the sync logic for member _salesOrderHeader</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncSalesOrderHeader(IEntityCore relatedEntity)
		{
			if(_salesOrderHeader!=relatedEntity)
			{
				DesetupSyncSalesOrderHeader(true, true);
				_salesOrderHeader = (SalesOrderHeaderEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _salesOrderHeader, new PropertyChangedEventHandler( OnSalesOrderHeaderPropertyChanged ), "SalesOrderHeader", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticSalesOrderHeaderSalesReasonRelations.SalesOrderHeaderEntityUsingSalesOrderIdStatic, true, new string[] {  } );
			}
		}
		protected SalesOrderHeaderSalesReasonEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_salesOrderHeader = (SalesOrderHeaderEntity)info.GetValue("_salesOrderHeader", typeof(SalesOrderHeaderEntity));
				if(_salesOrderHeader!=null)
				{
					_salesOrderHeader.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_salesReason = (SalesReasonEntity)info.GetValue("_salesReason", typeof(SalesReasonEntity));
				if(_salesReason!=null)
				{
					_salesReason.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}