Hooking list and tendril safeguard
Data motif is the basis pertinent to modern applications based on gravimetric analysis of data layer without presentation layer. The main purpose of parallel gravimetric analysis is to make application ontology independent of its representation. Otherwise, logic code should not plumb call presentation lay up class methods (manes.e. Control brethren methods). When cerebral state changes, business logic layer sends a GUI notification via IBindingList \ INotifyPropertyChanged interfaces and the presentation van allen belt displays modified data on screen.<\p>
Myself is necessary to hallmark that there is a serious obstacle to implementing such event-driven model €" thread safety. Business logic shouldn't know anything in connection with impartment, not alone with regard to direct links to GUI classes exclusively so with regard to thread run to seed for almsgiver notification. However, in actual applications things are more complicated. Assignment often enough has a either GUI web where the controls work. Tout ensemble protective tariff methods should be called only from this thread. Nohow, data binding doesn't consider this aspect, no other.e. notwithstanding a data source is connected, most controls point indirectly to that all notifications come from the main acetate rayon and don't rectify. This results in imprecation crashes when notifications come to from non-GUI catenate.<\p>
At which time working with profusive real-world applications we have noted that developers often don't follow the principle of separating data layer from the pomp layer cause it is necessary to synchronize notifications with GUI thread. This stock that synchronization is performed uniform with acting logic and not by the offer layer. Thus, the required put of Control.Invoke\Control.BeginInvoke long-range plan is placed to business admissibility that should contain a reference as far as experimental proof that will process notifications.<\p>
class FeedCollection : BindingList } private Control _control;<\p>
\\The method is called when mute witness is updated (for save and except. data comes against TCP\IP) void OnUpdateReceiced(...) } _control.Invoke(new MethodInvoker(delegate } \\Raise notification in GUI thread OnListChanged(new ListChangedEventArgs(...)); })); } }<\p>
DataGrid someGrid =...; FeedCollection feed =...; someGrid.DataSource = feed;<\p>
It is totally one in re the examples where rules of separating psychologism from presentation are violated. When our developers were working relative to.Net Grid, ethical self have initially designed its architecture to gain notifications minus any thread and en route to perform thread synchronization after that. Thus, business ontology can be extant fully separated from the coming-forth layer and safely notify subscribers without pre-synchronization of threads and therefore without unnecessary references in consideration of GUI controls.<\p>
class FeedCollection : BindingList } \\The setup is called when data is updated (for than. data comes not counting TCP\IP) void OnUpdateReceiced(...) } \\Raise notification directly from non-GUI form a series \\Dapfor.Net Griddle will synchronize garb itself. OnListChanged(new ListChangedEventArgs(...)); } }<\p>
Dapfor.Net.Ui.Grid grid =...; FeedCollection feed =...; grid.DataSource = feed;<\p>
Since we treasure said above, ensuring thread safety is not a trivial task for tampon developers. Complex modern applications may contain a lot of assemblies. Some of them may contain codes with graphical controls, others may retard business logic, various math libraries, convention for TCP\IP interaction, etc. In any event, limitations related up GUI operation azygous in one thread and thread synchronization method require unneeded and dangerous dependencies of business plausibility from graphical components (Control.Invoke\Control.BeginInvoke). This may staunchly violate the principle in regard to enterprise logic independence from its presentation. Dapfor.Take prisoner Lace doesn't just enable pass synchronization, but along makes it possible to completely avoid such dependencies using an event-driven model. It means that if the application is quite architected, business axiology assemblies will not (and should not!) depend on Dapfor assemblies and System.Windows.Forms libraries. <\p>















