Welcome to the WinForms feedback portal. We’re happy you’re here! If you have feedback on how to improve the WinForms, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

0
Votes

I want to save GCC data to database after inputting  a new record ( datasource using EF entity  local.toBindList).
So I register the SourceListRecordChanged  handler and call dbContext.SaveChanges();
but this does not work , it  seem to that the dbcontxt.entity.local has not changed yet.
at this time, if i call dbContext.SaveChanges() in a button pushed event.
it will save the new record to database successfuly.

which hander (what timing)  shoud i called to save the new record to database by just call the one function (dbContext.SaveChanges() )


The codes as follow:
initialize function
         this.gridGroupingControl.SourceListRecordChanged += new RecordChangedEventHandler(GridTableSourceListChanged);

         this.dbContext.Hospitals.Load();
         this.gridGroupingControl.DataSource = this.dbContext.Hospitals.Local.ToBindingList(); //suppose at this time the total count is 4

After  I add a new record to the GGC
the hanlder RecordChangedEventHandler Triggered:
function like this:
        void GridTableSourceListChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
        {
            Console.WriteLine("Fired");
            Console.WriteLine(this.dbContext.Hospitals.Local.Count);   //suppose  at this time the total count still is 4
            this.dbContext.SaveChanges();// save noting!!
        }

But if i pushed the save button later
        private void sfSave_Click(object sender, EventArgs e)
        {
            Console.WriteLine(this.dbContext.Hospitals.Local.Count); //  at this time the total count is 5

            this.dbContext.SaveChanges(); //save a new record
        }