/// <summary> Removes the sync logic for member _territories</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 DesetupSyncTerritories(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _territories, new PropertyChangedEventHandler( OnTerritoriesPropertyChanged ), "Territories", NW26.RelationClasses.StaticEmployeeTerritoriesRelations.TerritoriesEntityUsingTerritoryIdStatic, true, signalRelatedEntity, "EmployeeTerritories", resetFKFields, new int[] { (int)EmployeeTerritoriesFieldIndex.TerritoryId } );
			_territories = null;
		}
		/// <summary> setups the sync logic for member _territories</summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		private void SetupSyncTerritories(IEntityCore relatedEntity)
		{
			if(_territories!=relatedEntity)
			{
				DesetupSyncTerritories(true, true);
				_territories = (TerritoriesEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _territories, new PropertyChangedEventHandler( OnTerritoriesPropertyChanged ), "Territories", NW26.RelationClasses.StaticEmployeeTerritoriesRelations.TerritoriesEntityUsingTerritoryIdStatic, true, new string[] {  } );
			}
		}
		protected EmployeeTerritoriesEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_employees = (EmployeesEntity)info.GetValue("_employees", typeof(EmployeesEntity));
				if(_employees!=null)
				{
					_employees.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_territories = (TerritoriesEntity)info.GetValue("_territories", typeof(TerritoriesEntity));
				if(_territories!=null)
				{
					_territories.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
			
		}