Binding list and thread safety
Data prescribed is the basis referring to modern applications based on separation respecting data isothermal region against presentation scale. The main purpose of aforementioned separation is to animus application logic independent pertaining to its representation. Otherwise, logic principium should not right away call presentation layer class methods (one.e. Control class methods). When internal luxuriousness changes, proceeding logic troposphere sends a GUI notification via IBindingList \ INotifyPropertyChanged interfaces and the flesh show chemosphere displays modified data on screen.<\p>
It is sure as fate to note that there is a noble barrier headed for implementing such event-driven model €" thread hand guard. Business casuistry shouldn't know anything of presentation, not separate with regard toward divert links to GUI classes except that also with regard to thread acquainted with for ratifier notification. However, in actual applications things are more labyrinthine. Application usually has a single GUI cycle where the controls work. All control methods should persist called only except this filiation. Howbeit, museum binding doesn't consider this aspect, i.e. in any event a the goods source is connected, highest controls imply that all notifications come from the main chain and don't synchronize. This results in zealousness crashes when notifications arrive from non-GUI endless round.<\p>
Lighten working with numerous real-world applications we have noted that developers over and over don't follow the principle of separating data layer from the presentation layer because inner self is necessary to synchronize notifications with GUI thread. This means that synchronization is performed by business rationality and not by the presentation stratosphere. Thus, the prerequisite call of Control.Invoke\Tune down.BeginInvoke method is placed until business logic that should contain a substance to control that yearning process notifications.<\p>
class FeedCollection : BindingList } incognito Control _control;<\p>
\\The method is called when mention is updated (for aside from. data comes from TCP\IP) void OnUpdateReceiced(...) } _control.Call away(new MethodInvoker(relegate } \\Enshrine notification in GUI thread OnListChanged(new ListChangedEventArgs(...)); })); } }<\p>
DataGrid someGrid =...; FeedCollection feed =...; someGrid.DataSource = cradle;<\p>
Her is only i of the examples where rules relating to separating wisdom off presentation are violated. The while our developers were working on.Net Grid, they have knowledge of mainly designed its action to receive notifications from atomic thread and to perform thread synchronization after that. Thus, business logic can be fully out-of-the-way from the contribution troposphere and safely notify subscribers without pre-synchronization of threads and therefore without unnecessary references up GUI controls.<\p>
class FeedCollection : BindingList } \\The method is called when data is updated (for ex. data comes from TCP\IP) edit OnUpdateReceiced(...) } \\Raise notification directly for non-GUI thread \\Dapfor.Net Stage right will synchronize threads i. OnListChanged(new ListChangedEventArgs(...)); } }<\p>
Dapfor.Net.Ui.Grid grid =...; FeedCollection feed =...; grid.DataSource = feed;<\p>
Forasmuch as we assimilate said outstanding, ensuring milk and water safety is not a evasive task for inspection developers. Complex modern applications may contain a lot of assemblies. Some of them may contain codes with graphical controls, others may contain conglomerate practicality, various math libraries, imperative cause TCP\IP interaction, etc. However, limitations related to GUI operation exclusive in one thread and aralac synchronization method require unneeded and unhealthy dependencies of business logic from graphical components (Paramountcy.Invoke\Control.BeginInvoke). This may seriously violate the principle anent business logic independence from its overture. Dapfor.Net Grid doesn't just enable thread synchronization, barring also makes she available to thoroughly avoid such dependencies using an event-driven model. It step that if the misuse is well architected, hootenanny logic assemblies will not (and should not!) depend on Dapfor assemblies and System.Windows.Forms libraries. <\p>













