I
I
Ivan Vyrov2017-10-03 18:23:15
Algorithms
Ivan Vyrov, 2017-10-03 18:23:15

How to ensure the autonomy of the program from the server?

Given:

  • WCF application server
  • Appendix

The principle of the application:
  • The application sends information to the server
  • The server enters the necessary information into the database
  • Returns some calculations if necessary

The question is how to properly organize the offline operation of the application, for example, if the server
is offline (offline)?
Ideas:
Add a SQLite database to the application and write all the information to it, and after the server appears on the network, merge all the information to the server. Then the question arises: when working with the same functionality on different PCs, duplicate data may appear (example: registration of contracts, 2 different users can register different contracts for the same number and date) how can I get rid of this? It is not an option to allocate an interval of numbers for each user.
Update:
Contract numbers must be in digital order
.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
T
tsarevfs, 2017-10-03
@tsarevfs

Offline save a draft contract without a number and date. Register them when synchronizing with the server.

S
Saboteur, 2017-10-03
@saboteur_kiev

generate a unique contract number that includes something unique for each program instance.
The contract number is not a fixed number and can contain everything you need (it is advisable to use regular characters, of course).

D
Decadal, 2017-10-03
@Decadal

uid

P
Peter, 2017-10-03
@petermzg

If you want contract numbers in order, forbid offline.
You can first make a draft contract, without a number, but then be sure to register on the server and get a number.
For everything else that is added, it receives an ID greater than 10 million (for example), and during synchronization, all records that have ID> 10 million are sent and new IDs are received in response. Old ones are replaced by new ones.

E
eRKa, 2017-10-03
@kttotto

If they want to take into account such cases, they usually use queues, ready-made or self-written. Before giving to the server, the document is queued, there is a connection - the queue is moving, no - the queue is growing. I'm not aware of the subject area, but if the numbering order is important, then maybe it's worth transferring the numbering to the server? The server received and numbered itself based on some metadata that will come with the document.

A
aynur_safin, 2017-10-03
@aynur_safin

If, according to the conditions of the task, the server is sometimes offline, and the client is always online, then you just need to transfer the number generation to a service with a good SLA.
If the client is offline and there is no mob. Internet, but there is a mob. communication, i.e. not quite in the taiga, then it’s possible in an oak way: make an SMS service, send an SMS to a number, the service sends a generated number in response, drive it in with pens.

D
d-stream, 2017-10-04
@d-stream

In fact, you will get a small server inside the application, which will automatically lead to the interaction option application - proxy (internal) server - real server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question