/// <summary> Removes the sync logic for member _specialOfferProduct</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 DesetupSyncSpecialOfferProduct(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _specialOfferProduct, new PropertyChangedEventHandler( OnSpecialOfferProductPropertyChanged ), "SpecialOfferProduct", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticSalesOrderDetailRelations.SpecialOfferProductEntityUsingProductIdSpecialOfferIdStatic, true, signalRelatedEntity, "SalesOrderDetails", resetFKFields, new int[] { (int)SalesOrderDetailFieldIndex.ProductId, (int)SalesOrderDetailFieldIndex.SpecialOfferId } );
			_specialOfferProduct = null;
		}
		/// <summary> setups the sync logic for member _specialOfferProduct</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncSpecialOfferProduct(IEntityCore relatedEntity)
		{
			if(_specialOfferProduct!=relatedEntity)
			{
				DesetupSyncSpecialOfferProduct(true, true);
				_specialOfferProduct = (SpecialOfferProductEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _specialOfferProduct, new PropertyChangedEventHandler( OnSpecialOfferProductPropertyChanged ), "SpecialOfferProduct", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticSalesOrderDetailRelations.SpecialOfferProductEntityUsingProductIdSpecialOfferIdStatic, true, new string[] {  } );
			}
		}
		protected SalesOrderDetailEntity(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);
				}
				_specialOfferProduct = (SpecialOfferProductEntity)info.GetValue("_specialOfferProduct", typeof(SpecialOfferProductEntity));
				if(_specialOfferProduct!=null)
				{
					_specialOfferProduct.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}