/// <summary> setups the sync logic for member _salesReason</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncSalesReason(IEntityCore relatedEntity)
 {
     if (_salesReason != relatedEntity)
     {
         DesetupSyncSalesReason(true, true);
         _salesReason = (SalesReasonEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_salesReason, new PropertyChangedEventHandler(OnSalesReasonPropertyChanged), "SalesReason", AdventureWorks.Dal.Adapter.v51.RelationClasses.StaticSalesOrderHeaderSalesReasonRelations.SalesReasonEntityUsingSalesReasonIdStatic, true, new string[] {  });
     }
 }
 protected SalesOrderHeaderSalesReasonEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (SerializationHelper.Optimization != SerializationOptimization.Fast)
     {
         _salesOrderHeader = (SalesOrderHeaderEntity)info.GetValue("_salesOrderHeader", typeof(SalesOrderHeaderEntity));
         if (_salesOrderHeader != null)
         {
             _salesOrderHeader.AfterSave += new EventHandler(OnEntityAfterSave);
         }
         _salesReason = (SalesReasonEntity)info.GetValue("_salesReason", typeof(SalesReasonEntity));
         if (_salesReason != null)
         {
             _salesReason.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 _salesReason</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 DesetupSyncSalesReason(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_salesReason, new PropertyChangedEventHandler(OnSalesReasonPropertyChanged), "SalesReason", AdventureWorks.Dal.Adapter.v51.RelationClasses.StaticSalesOrderHeaderSalesReasonRelations.SalesReasonEntityUsingSalesReasonIdStatic, true, signalRelatedEntity, "SalesOrderHeaderSalesReasons", resetFKFields, new int[] { (int)SalesOrderHeaderSalesReasonFieldIndex.SalesReasonId });
     _salesReason = null;
 }