/// <summary> setups the sync logic for member _unitMeasure</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncUnitMeasure(IEntityCore relatedEntity)
 {
     if (_unitMeasure != relatedEntity)
     {
         DesetupSyncUnitMeasure(true, true);
         _unitMeasure = (UnitMeasureEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_unitMeasure, new PropertyChangedEventHandler(OnUnitMeasurePropertyChanged), "UnitMeasure", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticProductVendorRelations.UnitMeasureEntityUsingUnitMeasureCodeStatic, true, new string[] {  });
     }
 }
 protected ProductVendorEntity(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);
         }
         _unitMeasure = (UnitMeasureEntity)info.GetValue("_unitMeasure", typeof(UnitMeasureEntity));
         if (_unitMeasure != null)
         {
             _unitMeasure.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _vendor = (VendorEntity)info.GetValue("_vendor", typeof(VendorEntity));
         if (_vendor != null)
         {
             _vendor.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
		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> setups the sync logic for member _unitMeasure_</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncUnitMeasure_(IEntityCore relatedEntity)
		{
			if(_unitMeasure_!=relatedEntity)
			{
				DesetupSyncUnitMeasure_(true, true);
				_unitMeasure_ = (UnitMeasureEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _unitMeasure_, new PropertyChangedEventHandler( OnUnitMeasure_PropertyChanged ), "UnitMeasure_", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticProductRelations.UnitMeasureEntityUsingWeightUnitMeasureCodeStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _unitMeasure_</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 DesetupSyncUnitMeasure_(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _unitMeasure_, new PropertyChangedEventHandler( OnUnitMeasure_PropertyChanged ), "UnitMeasure_", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticProductRelations.UnitMeasureEntityUsingWeightUnitMeasureCodeStatic, true, signalRelatedEntity, "Products_", resetFKFields, new int[] { (int)ProductFieldIndex.WeightUnitMeasureCode } );
			_unitMeasure_ = null;
		}
		/// <summary> setups the sync logic for member _unitMeasure</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncUnitMeasure(IEntityCore relatedEntity)
		{
			if(_unitMeasure!=relatedEntity)
			{
				DesetupSyncUnitMeasure(true, true);
				_unitMeasure = (UnitMeasureEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _unitMeasure, new PropertyChangedEventHandler( OnUnitMeasurePropertyChanged ), "UnitMeasure", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticBillOfMaterialRelations.UnitMeasureEntityUsingUnitMeasureCodeStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _unitMeasure</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 DesetupSyncUnitMeasure(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _unitMeasure, new PropertyChangedEventHandler( OnUnitMeasurePropertyChanged ), "UnitMeasure", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticBillOfMaterialRelations.UnitMeasureEntityUsingUnitMeasureCodeStatic, true, signalRelatedEntity, "BillOfMaterials", resetFKFields, new int[] { (int)BillOfMaterialFieldIndex.UnitMeasureCode } );
			_unitMeasure = null;
		}
		protected BillOfMaterialEntity(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);
				}
				_product_ = (ProductEntity)info.GetValue("_product_", typeof(ProductEntity));
				if(_product_!=null)
				{
					_product_.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 _unitMeasure</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 DesetupSyncUnitMeasure(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_unitMeasure, new PropertyChangedEventHandler(OnUnitMeasurePropertyChanged), "UnitMeasure", AdventureWorks.Dal.Adapter.v41.RelationClasses.StaticProductVendorRelations.UnitMeasureEntityUsingUnitMeasureCodeStatic, true, signalRelatedEntity, "ProductVendors", resetFKFields, new int[] { (int)ProductVendorFieldIndex.UnitMeasureCode });
     _unitMeasure = null;
 }