Technique in a C # multi-user application, where all clients have their data up to date from a central database

In a multi-user environment: How do you make sure that all customers see each other's changes? What is the best way to do this?

In the past, I created a C # application and installed it on 2 pcs. It is connected to the central SQL Express server (the client application worked with the Entity Framework Code First as ORM). When client1 added an entry to the database, this was clearly not explicit to client2. Only if client2 again took all the data (hard update), was this change visible.

Now I am looking for a solution on how this "synchronization" (?) Can or should be done. I like working with Entity Framework Code. Firstly, it would be nice if the solution could save that. Also, the application is still at a very early stage. I thought having a central database and several clients connecting to it, but I'm not sure if this is a good solution. If your suggestions or solutions require a central server application to which clients connect (and where the server application performs database processing), this is not a problem.

If possible, a basic custom solution or some basic code that shows how to always work with the latest data can be very useful!

Related questions:

  • Entity Framework - notification of changes in the database (in the database)
  • Entity Framework data updates in a multi-tenant environment with a central database
  • Entity wireframe data context not synchronized with database?

Thanks in advance

+8
c # database multi-user ef-code-first
source share
2 answers

It depends on your environment and the data you manage, and on the architecture you want.

If this is normal / acceptable to allow clients to have copies of the data that they can work with, they need to work with the data if they are not connected to the central server, then you can use the Sync Framework.

You will have your central SQL Server, as usual, and use the Sync Framework to synchronize with clients.

You must write a "Provider" who will decide how to allow changes made to the same data by different customers, etc.

You will need to put SQL Express (or possibly LocalDB (new name for SQLCE)) on client computers.

Then create your Entity Framework model / code to access the local database instead of the central one.

http://blogs.msdn.com/b/sync/archive/2008/06/24/sample-sql-express-client-synchronization-using-sync-services-for-ado-net.aspx

Otherwise, it will be reduced to the design and implementation of some โ€œlayersโ€ and the subsequent use of the distributed architecture of Internet / Database Architecture / SOA.

Good free resource:

http://msdn.microsoft.com/en-us/library/ff650706.aspx

http://mtechsoa2011.blogspot.co.uk/2011/04/soa-vs-distributed-internet_27.html

Some useful books:

http://www.amazon.co.uk/Service-Oriented-Architecture-Concepts-Technology-Computing/dp/0131858580/ref=sr_1_1?s=books&ie=UTF8&qid=1343295432&sr=1-1

+2
source share

Another solution is to create an โ€œinterfaceโ€ for your database, and each data entry operation from a client can notify other clients. You can implement such a WCF interface with its callbacks. I donโ€™t have simple code to solve the whole architecture ... If you ask a more specific question about creating an n-tier application with WCF, I will try to help.

+1
source share

All Articles