/// <summary> setups the sync logic for member _productPhoto</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncProductPhoto(IEntityCore relatedEntity)
 {
     if (_productPhoto != relatedEntity)
     {
         DesetupSyncProductPhoto(true, true);
         _productPhoto = (ProductPhotoEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_productPhoto, new PropertyChangedEventHandler(OnProductPhotoPropertyChanged), "ProductPhoto", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticProductProductPhotoRelations.ProductPhotoEntityUsingProductPhotoIdStatic, true, new string[] {  });
     }
 }
 protected ProductProductPhotoEntity(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);
         }
         _productPhoto = (ProductPhotoEntity)info.GetValue("_productPhoto", typeof(ProductPhotoEntity));
         if (_productPhoto != null)
         {
             _productPhoto.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 _productPhoto</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncProductPhoto(IEntityCore relatedEntity)
		{
			if(_productPhoto!=relatedEntity)
			{
				DesetupSyncProductPhoto(true, true);
				_productPhoto = (ProductPhotoEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _productPhoto, new PropertyChangedEventHandler( OnProductPhotoPropertyChanged ), "ProductPhoto", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticProductProductPhotoRelations.ProductPhotoEntityUsingProductPhotoIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _productPhoto</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 DesetupSyncProductPhoto(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _productPhoto, new PropertyChangedEventHandler( OnProductPhotoPropertyChanged ), "ProductPhoto", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticProductProductPhotoRelations.ProductPhotoEntityUsingProductPhotoIdStatic, true, signalRelatedEntity, "ProductProductPhotos", resetFKFields, new int[] { (int)ProductProductPhotoFieldIndex.ProductPhotoId } );
			_productPhoto = null;
		}
		protected ProductProductPhotoEntity(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);
				}
				_productPhoto = (ProductPhotoEntity)info.GetValue("_productPhoto", typeof(ProductPhotoEntity));
				if(_productPhoto!=null)
				{
					_productPhoto.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 _productPhoto</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 DesetupSyncProductPhoto(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_productPhoto, new PropertyChangedEventHandler(OnProductPhotoPropertyChanged), "ProductPhoto", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticProductProductPhotoRelations.ProductPhotoEntityUsingProductPhotoIdStatic, true, signalRelatedEntity, "ProductProductPhotos", resetFKFields, new int[] { (int)ProductProductPhotoFieldIndex.ProductPhotoId });
     _productPhoto = null;
 }