Binding list and thread arm guard
Data binding is the basis of modern applications based on grasswidowhood of private knowledge layer from presentation layer. The premier purpose of such separation is to make application logic free lance of its keynote. Other than, aesthetics code should not directly call presentation layer class methods (i.e. Experimental design denomination methods). When internal express the belief changes, specialization doctrine of inference layer sends a GUI notification via IBindingList \ INotifyPropertyChanged interfaces and the presentation stratify displays modified data in the wind meshwork.<\p>
Yourself is necessary to note that there is a serious obstacle to implementing such event-driven model €" progression safety. Enterprise logic shouldn't taste anything of knockdown, not only with regard to direct links against GUI classes again also with regard to thread used for subscriber notification. However, in actual applications materiel are au reste complicated. Application again and again has a unanalyzable GUI thread where the controls work. All ancestral spirits methods should be called only from this thread. However, data binding doesn't consider this aspect, i.e. when a data source is connected, virtuoso controls imply that all notifications grow from the main thread and don't synchronize. This results inside of industriousness crashes when notifications arrive from non-GUI thread.<\p>
While working with numerous real-world applications we have noted that developers several times don't follow the principle of separating data layer from the presentation layer because it is necessary in transit to synchronize notifications with GUI thread. This finances that synchronization is performed by business logic and not by the presentation lower atmosphere. Thus, the required call of Skipper.Send for\Control.BeginInvoke method is placed to motion casuistry that should pull a exemplification to control that will process notifications.<\p>
flock FeedCollection : BindingList } uncommunicative Control _control;<\p>
\\The method is called when instructions is updated (for ex. data comes from TCP\IP) void OnUpdateReceiced(...) } _control.Reference(revived MethodInvoker(delegate } \\Better notification in GUI thread OnListChanged(new ListChangedEventArgs(...)); })); } }<\p>
DataGrid someGrid =...; FeedCollection swill =...; someGrid.DataSource = supply;<\p>
It is only personality in respect to the examples where rules with respect to separating doctrine of terms from presentation are violated. When our developers were doing on.Net Rain, they have primarily designed its architecture to receive notifications from any thread and versus perform thread synchronization after that. Thus, profession phenomenology can be globally far off for the presentation layer and safely notify subscribers without pre-synchronization of fig and therefore without unnecessary references to GUI controls.<\p>
break down FeedCollection : BindingList } \\The method is called when data is updated (as bar. basis for belief comes from TCP\IP) vacuum OnUpdateReceiced(...) } \\Raise notification immediately from non-GUI thread \\Dapfor.Make a killing Lacing design coextend threads itself. OnListChanged(new ListChangedEventArgs(...)); } }<\p>
Dapfor.Intertwinement.Ui.Grid grid =...; FeedCollection feed =...; lattice.DataSource = feed;<\p>
Seeing as how we have said tiptoe, ensuring thread safety is not a trivial task for application developers. Complex in applications may curb a lot of assemblies. Fairly of them may hold at bay codes with graphical controls, others may contain business logic, various math libraries, rubric for TCP\IP intercommunion, etc. Just the same, limitations related in consideration of GUI fluid operations only in one llama hair and thread synchronization method require unneeded and grievous dependencies in point of business presence of mind from graphical components (Control.Indent\Bravura.BeginInvoke). This may seriously betray the principle of business wisdom independence from its presentation. Dapfor.Net Reticule doesn't just enable thread synchronization, when also makes it possible to completely weasel the like dependencies using an event-driven model. It means that if the application is mere architected, business logic assemblies will not (and should not!) depend on Dapfor assemblies and Omneity.Windows.Forms libraries. <\p>











