Search code examples
c#databaseweb-servicesclient-serverdata-synchronization

Single Database and Many Users Desktop Application


I am new to this concept so i need guidance that what will be best to use in following scenario.

I have to make a desktop application that contains many features like parts Stock ,Employees Data,Company Cars Data etc etc.

now the problem is that many users would be using the application and offices situated are in different cities in which this application is installed.

I want a scheme that if one uploads any data to database other gets its reflection and other instantly gets updated.for example if more cars are added everyone using gets their cars list updated.

I was having idea to use webservices and data should be stored somewhere on website database so that everyone's application refreshes lists every say 20 seconds or so.

Any help is appreciated


Solution

  • You wouldn't reload all your data constantly; there are a couple of common approaches here:

    • keep a list of changes; if you add new data you add the primary data record and you write the fact that the change happened (essentially an "events" list). Then you can query the change log periodically to get and additions/updates/deletes simply by asking for all events after (x)
    • if the infrastructure allows, some kind of pub/sub framework - same approach really but typically using middleware for the changes, rather than the main DB

    re how you get the data; polling is simple and effective; active pushing is harder to setup but may reduce latency - not sure it is worth it here

    Another approach, though, is to design it as a web app - then all your data lives at the server-farm and is trivial to update immediately. Your "desktop" app could be a web page using ajax