/// <summary> setups the sync logic for member _shift</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncShift(IEntityCore relatedEntity)
 {
     if (_shift != relatedEntity)
     {
         DesetupSyncShift(true, true);
         _shift = (ShiftEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_shift, new PropertyChangedEventHandler(OnShiftPropertyChanged), "Shift", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.ShiftEntityUsingShiftIdStatic, true, new string[] {  });
     }
 }
 protected EmployeeDepartmentHistoryEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _department = (DepartmentEntity)info.GetValue("_department", typeof(DepartmentEntity));
         if (_department != null)
         {
             _department.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _employee = (EmployeeEntity)info.GetValue("_employee", typeof(EmployeeEntity));
         if (_employee != null)
         {
             _employee.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _shift = (ShiftEntity)info.GetValue("_shift", typeof(ShiftEntity));
         if (_shift != null)
         {
             _shift.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 _shift</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 DesetupSyncShift(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_shift, new PropertyChangedEventHandler(OnShiftPropertyChanged), "Shift", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.ShiftEntityUsingShiftIdStatic, true, signalRelatedEntity, "EmployeeDepartmentHistories", resetFKFields, new int[] { (int)EmployeeDepartmentHistoryFieldIndex.ShiftId });
     _shift = null;
 }
		/// <summary> setups the sync logic for member _shift</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncShift(IEntityCore relatedEntity)
		{
			if(_shift!=relatedEntity)
			{
				DesetupSyncShift(true, true);
				_shift = (ShiftEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _shift, new PropertyChangedEventHandler( OnShiftPropertyChanged ), "Shift", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.ShiftEntityUsingShiftIdStatic, true, new string[] {  } );
			}
		}
		/// <summary> Removes the sync logic for member _shift</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 DesetupSyncShift(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _shift, new PropertyChangedEventHandler( OnShiftPropertyChanged ), "Shift", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.ShiftEntityUsingShiftIdStatic, true, signalRelatedEntity, "EmployeeDepartmentHistories", resetFKFields, new int[] { (int)EmployeeDepartmentHistoryFieldIndex.ShiftId } );
			_shift = null;
		}
		protected EmployeeDepartmentHistoryEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_department = (DepartmentEntity)info.GetValue("_department", typeof(DepartmentEntity));
				if(_department!=null)
				{
					_department.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_employee = (EmployeeEntity)info.GetValue("_employee", typeof(EmployeeEntity));
				if(_employee!=null)
				{
					_employee.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_shift = (ShiftEntity)info.GetValue("_shift", typeof(ShiftEntity));
				if(_shift!=null)
				{
					_shift.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}