protected ProductEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_billOfMaterials = (EntityCollection<BillOfMaterialEntity>)info.GetValue("_billOfMaterials", typeof(EntityCollection<BillOfMaterialEntity>));
				_billOfMaterials_ = (EntityCollection<BillOfMaterialEntity>)info.GetValue("_billOfMaterials_", typeof(EntityCollection<BillOfMaterialEntity>));
				_productCostHistories = (EntityCollection<ProductCostHistoryEntity>)info.GetValue("_productCostHistories", typeof(EntityCollection<ProductCostHistoryEntity>));
				_productDocuments = (EntityCollection<ProductDocumentEntity>)info.GetValue("_productDocuments", typeof(EntityCollection<ProductDocumentEntity>));
				_productInventories = (EntityCollection<ProductInventoryEntity>)info.GetValue("_productInventories", typeof(EntityCollection<ProductInventoryEntity>));
				_productListPriceHistories = (EntityCollection<ProductListPriceHistoryEntity>)info.GetValue("_productListPriceHistories", typeof(EntityCollection<ProductListPriceHistoryEntity>));
				_productProductPhotos = (EntityCollection<ProductProductPhotoEntity>)info.GetValue("_productProductPhotos", typeof(EntityCollection<ProductProductPhotoEntity>));
				_productReviews = (EntityCollection<ProductReviewEntity>)info.GetValue("_productReviews", typeof(EntityCollection<ProductReviewEntity>));
				_productVendors = (EntityCollection<ProductVendorEntity>)info.GetValue("_productVendors", typeof(EntityCollection<ProductVendorEntity>));
				_purchaseOrderDetails = (EntityCollection<PurchaseOrderDetailEntity>)info.GetValue("_purchaseOrderDetails", typeof(EntityCollection<PurchaseOrderDetailEntity>));
				_shoppingCartItems = (EntityCollection<ShoppingCartItemEntity>)info.GetValue("_shoppingCartItems", typeof(EntityCollection<ShoppingCartItemEntity>));
				_specialOfferProducts = (EntityCollection<SpecialOfferProductEntity>)info.GetValue("_specialOfferProducts", typeof(EntityCollection<SpecialOfferProductEntity>));
				_transactionHistories = (EntityCollection<TransactionHistoryEntity>)info.GetValue("_transactionHistories", typeof(EntityCollection<TransactionHistoryEntity>));
				_workOrders = (EntityCollection<WorkOrderEntity>)info.GetValue("_workOrders", typeof(EntityCollection<WorkOrderEntity>));
				_productModel = (ProductModelEntity)info.GetValue("_productModel", typeof(ProductModelEntity));
				if(_productModel!=null)
				{
					_productModel.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_productSubcategory = (ProductSubcategoryEntity)info.GetValue("_productSubcategory", typeof(ProductSubcategoryEntity));
				if(_productSubcategory!=null)
				{
					_productSubcategory.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_unitMeasure = (UnitMeasureEntity)info.GetValue("_unitMeasure", typeof(UnitMeasureEntity));
				if(_unitMeasure!=null)
				{
					_unitMeasure.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_unitMeasure_ = (UnitMeasureEntity)info.GetValue("_unitMeasure_", typeof(UnitMeasureEntity));
				if(_unitMeasure_!=null)
				{
					_unitMeasure_.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 _productSubcategory</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 DesetupSyncProductSubcategory(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _productSubcategory, new PropertyChangedEventHandler( OnProductSubcategoryPropertyChanged ), "ProductSubcategory", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticProductRelations.ProductSubcategoryEntityUsingProductSubcategoryIdStatic, true, signalRelatedEntity, "Products", resetFKFields, new int[] { (int)ProductFieldIndex.ProductSubcategoryId } );
			_productSubcategory = null;
		}
		/// <summary> setups the sync logic for member _productSubcategory</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncProductSubcategory(IEntityCore relatedEntity)
		{
			if(_productSubcategory!=relatedEntity)
			{
				DesetupSyncProductSubcategory(true, true);
				_productSubcategory = (ProductSubcategoryEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _productSubcategory, new PropertyChangedEventHandler( OnProductSubcategoryPropertyChanged ), "ProductSubcategory", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticProductRelations.ProductSubcategoryEntityUsingProductSubcategoryIdStatic, true, new string[] {  } );
			}
		}