/// <summary> setups the sync logic for member _region</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRegion(IEntityCore relatedEntity)
 {
     if (_region != relatedEntity)
     {
         DesetupSyncRegion(true, true);
         _region = (RegionEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_region, new PropertyChangedEventHandler(OnRegionPropertyChanged), "Region", Northwind.Data.RelationClasses.StaticTerritoryRelations.RegionEntityUsingRegionIdStatic, true, new string[] {  });
     }
 }
 protected TerritoryEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _employeeTerritories = (EntityCollection <EmployeeTerritoryEntity>)info.GetValue("_employeeTerritories", typeof(EntityCollection <EmployeeTerritoryEntity>));
         _region = (RegionEntity)info.GetValue("_region", typeof(RegionEntity));
         if (_region != null)
         {
             _region.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 _region</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 DesetupSyncRegion(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_region, new PropertyChangedEventHandler(OnRegionPropertyChanged), "Region", Northwind.Data.RelationClasses.StaticTerritoryRelations.RegionEntityUsingRegionIdStatic, true, signalRelatedEntity, "Territories", resetFKFields, new int[] { (int)TerritoryFieldIndex.RegionId });
     _region = null;
 }
 /// <summary> setups the sync logic for member _region</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRegion(IEntityCore relatedEntity)
 {
     if(_region!=relatedEntity)
     {
         DesetupSyncRegion(true, true);
         _region = (RegionEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _region, new PropertyChangedEventHandler( OnRegionPropertyChanged ), "Region", Northwind.Data.RelationClasses.StaticTerritoryRelations.RegionEntityUsingRegionIdStatic, true, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _region</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 DesetupSyncRegion(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _region, new PropertyChangedEventHandler( OnRegionPropertyChanged ), "Region", Northwind.Data.RelationClasses.StaticTerritoryRelations.RegionEntityUsingRegionIdStatic, true, signalRelatedEntity, "Territories", resetFKFields, new int[] { (int)TerritoryFieldIndex.RegionId } );
     _region = null;
 }
 protected TerritoryEntity(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if(SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _employeeTerritories = (EntityCollection<EmployeeTerritoryEntity>)info.GetValue("_employeeTerritories", typeof(EntityCollection<EmployeeTerritoryEntity>));
         _region = (RegionEntity)info.GetValue("_region", typeof(RegionEntity));
         if(_region!=null)
         {
             _region.AfterSave+=new EventHandler(OnEntityAfterSave);
         }
         this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
     }
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }