/// <summary> setups the sync logic for member _workOrder</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncWorkOrder(IEntityCore relatedEntity)
 {
     if (_workOrder != relatedEntity)
     {
         DesetupSyncWorkOrder(true, true);
         _workOrder = (WorkOrderEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_workOrder, new PropertyChangedEventHandler(OnWorkOrderPropertyChanged), "WorkOrder", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticWorkOrderRoutingRelations.WorkOrderEntityUsingWorkOrderIdStatic, true, new string[] {  });
     }
 }
 protected WorkOrderRoutingEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _location = (LocationEntity)info.GetValue("_location", typeof(LocationEntity));
         if (_location != null)
         {
             _location.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _workOrder = (WorkOrderEntity)info.GetValue("_workOrder", typeof(WorkOrderEntity));
         if (_workOrder != null)
         {
             _workOrder.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 _workOrder</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncWorkOrder(IEntityCore relatedEntity)
		{
			if(_workOrder!=relatedEntity)
			{
				DesetupSyncWorkOrder(true, true);
				_workOrder = (WorkOrderEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _workOrder, new PropertyChangedEventHandler( OnWorkOrderPropertyChanged ), "WorkOrder", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticWorkOrderRoutingRelations.WorkOrderEntityUsingWorkOrderIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _workOrder</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 DesetupSyncWorkOrder(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _workOrder, new PropertyChangedEventHandler( OnWorkOrderPropertyChanged ), "WorkOrder", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticWorkOrderRoutingRelations.WorkOrderEntityUsingWorkOrderIdStatic, true, signalRelatedEntity, "WorkOrderRoutings", resetFKFields, new int[] { (int)WorkOrderRoutingFieldIndex.WorkOrderId } );
			_workOrder = null;
		}
		protected WorkOrderRoutingEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_location = (LocationEntity)info.GetValue("_location", typeof(LocationEntity));
				if(_location!=null)
				{
					_location.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_workOrder = (WorkOrderEntity)info.GetValue("_workOrder", typeof(WorkOrderEntity));
				if(_workOrder!=null)
				{
					_workOrder.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 _workOrder</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 DesetupSyncWorkOrder(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_workOrder, new PropertyChangedEventHandler(OnWorkOrderPropertyChanged), "WorkOrder", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticWorkOrderRoutingRelations.WorkOrderEntityUsingWorkOrderIdStatic, true, signalRelatedEntity, "WorkOrderRoutings", resetFKFields, new int[] { (int)WorkOrderRoutingFieldIndex.WorkOrderId });
     _workOrder = null;
 }