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 _department</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 DesetupSyncDepartment(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_department, new PropertyChangedEventHandler(OnDepartmentPropertyChanged), "Department", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.DepartmentEntityUsingDepartmentIdStatic, true, signalRelatedEntity, "EmployeeDepartmentHistories", resetFKFields, new int[] { (int)EmployeeDepartmentHistoryFieldIndex.DepartmentId });
     _department = null;
 }
		/// <summary> Removes the sync logic for member _department</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 DesetupSyncDepartment(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _department, new PropertyChangedEventHandler( OnDepartmentPropertyChanged ), "Department", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.DepartmentEntityUsingDepartmentIdStatic, true, signalRelatedEntity, "EmployeeDepartmentHistories", resetFKFields, new int[] { (int)EmployeeDepartmentHistoryFieldIndex.DepartmentId } );
			_department = null;
		}
		/// <summary> setups the sync logic for member _department</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncDepartment(IEntityCore relatedEntity)
		{
			if(_department!=relatedEntity)
			{
				DesetupSyncDepartment(true, true);
				_department = (DepartmentEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _department, new PropertyChangedEventHandler( OnDepartmentPropertyChanged ), "Department", AdventureWorks.Dal.Adapter.v42.RelationClasses.StaticEmployeeDepartmentHistoryRelations.DepartmentEntityUsingDepartmentIdStatic, 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
		}