views:

43

answers:

0

Hi,

What approach(es) would you recommend regarding a WinForms application that will have both the user interface & a scheduling components regarding sharing configuration data from the database? (exposed in the program via DataTable) Assume both the scheduled task and the user interface can make updates to the shared data. Also assume that the scheduling component is part of the winforms application itself (and spawns a separate thread when it runs)

What approaches are available in WinForms / ADO.net (DataTables) that would allow one to develop some sort of sharing of data approach? EDIT: In fact to make this question more specific I'll ask more directed questions below:


Category - Shared

Background: The design approach was to share the data between parts of the application, for example if updating via a "manage links" dialog, and at the same time the scheduled task was performing a webcrawl against the links, then the 'manage links' dialog would automatically change to reflect status of the link.

Q1 - How would one side get a notification if the other client had changed the data from under-its-feet so to speak? Would you use the same DataTable in the user interface and the scheduling component and some callback that might be available?


Category - Not Shared

Background: In this case the "manage links" dialog would effectively work on it's own copy of the data until the user pushes the "OK" button and then the changes are brought back into the main application DataTable / Database. But if the scheduling thread was running then it should wait until this is finished before then updating.

Q2 - What is the easiest "lock" approach here? How would people normally code this in a winforms / ADO.net (datatable) type environment?


Thanks in advance