Ignacio Machin ( .NET/ C# MVP ) said:
Hi,
No need for a pattern here, just the correct placement of the DB store, I
will assume that you are using SQL-server.
What you can do is using a central server for all transactions , it should
be fast enough for a small retail outlet if using a business dsl.
You will also install a local server that will sync with the remote from
time to time.
If the remote server fails you can switch to the local one and will work
with the latest data the local has.
If your DB operations in your app are located in the same place (like a
static class) it's easy to switch, just change the connection string and
you are ready, the rest of the system will work as usual
You may need to create a timer or some other mechanism to check for the
restore of the main server.
Then the other part is how to send the locally stored data to the remote
server. for this you could insert the remote as a linked server to the
local and update the remote table from the local one.
Thanks to everyone that has posted.
My personal choice would be to get business DSL service for each location
with a service level agreement that guarantees DSL service at a set % of
uptime and guarantees a set time limit for fixes when the connection does go
down - then just use a central server. But, that leaves the store down in
case of an internet outage (which the store owners admit is rare).
But, I am thinking of making this a simple app with a local server/db for
each store and add a synchronization feature that runs at a set interval.
The data won't exactly be real time, but doing real-time updates in
disconnected locations will require some type of message queue in case the
internet connection goes down between locations and you also have a fight on
your hands when dealing with concurrency.
I also cannot forget that the owner is planning on adding 6 stores this
year. So, each new store needs a ?simple? way of catching up with all of
the other stores before beginning processing on its own.
The questions I am trying to answer are .....
If a store is out of the loop for 1...n days, how do you apply it's
changes without overwriting newer db changes already in the system? The
only thing I can think of is a timestamp on each change. Does SQL Server do
this internally automatically?
What about SQL Server Master-Master relationships? Could I connect SQL
instances over the web and have them auto-update each other with only the
most recent changes to a record?
Synchronizing the DBs looks like its going to be a pain.......but there
must be an answer. How do banks, credit agencies, national companies keep
their data real-time and always available?
Keep those great ideas coming......I can use all of the help I can get with
this one.
Thanks again for your help. I will be glad to outline the solution here for
all as soon as I decide on one.
If a