c# - How to update a BindingSource based on a modified DataContext -
In my application, / P> Then I am binding the dictionary with the binding source: I refresh the datacontext and dictionary regularly when new jobs are added to the database (whether directly running through a local application or on a different machine): < / P> How can I also update the binding source to accommodate changes? Jobs = dbc.Jobs.ToDictionary (j = & gt; j.Id, j = & gt; j);
bsJob.DataSource = jobManager.Jobs.Values.ToList ();
dbc.Refresh (RefreshMode.OverwriteCurrentValues, dbc.Job); Jobs = dbc.Job.ToDictionary (J => J.D., J = & gt; J);
I do not see the relation from the job class to the customer class, so I will assume that you type it Want to and not the job manager? Customer value. List ();
There are already some types of events triggering your refresh, because you have mentioned that you update "regular", then you basically have a binding source at that time. Datasource Assign a new value to the property.
Dbc.Refresh (RefreshMode.OverwriteCurrentValues, dbc.Customer); Customer = dbc.Customer.ToDictionary (C => CID, C => C); BsJob.DataSource = jobManager.Jobs.Values.ToList (); // It was right to believe this statement
Comments
Post a Comment