There is a WCF service. This service has several endpoints with different capabilities. One point gives access to the data, and through the other one files are loaded.

Of course, you have to create 2 different proxies.

When a client receives data, but the Locked feature is written in the database, which does not allow other users to access this data during editing. The event is also hung up on Closed and Fault, so that the data would not remain blocked under unforeseen circumstances.

Can one endpoint tell the other that the first point needs to reply to the first point?

Now this logic is described on the client side. Is it correct?

  • In theory, locks should be short-term, so under normal circumstances it is enough just to wait for the lock to be received. Do you have a long lock? - VladD
  • @VladD. The user receives data and the data is specifically blocked for a while while the user is working with them. The database is marked as Locked and the WCF service does not issue them to other users. The problem is whether it is possible on the service side to report from one point to another: "Now I deal with this data, please do not transfer them to the Avalible state when disconnecting the client.". Now I am sending a request from the client that it is necessary to unsubscribe. - iluxa1810

1 answer 1

Alternatively, you can make a lock with reference counting - the same user is allowed to block records any number of times, the lock is removed when all sessions are disconnected.

In the database, you will need the fields LockedBy (the name of the user who seized the lock) and LockCount.

  • I think that your decision is the most correct and compact. Using it in the event of closing the connection, you can set an additional condition that LockedBy should be equal to the user in the context. If there is a Null, then another service has intercepted and it is unnecessary to change statuses, since another point will take care of this. - iluxa1810
  • And how is the script “the user locked up the base and going to have lunch / dumped home / went on vacation”? (This is not a trick, I'm seriously interested.) - VladD
  • @VladD, Well, this can be solved by some timeouts. It seems something like that can be set in the WCF configuration - iluxa1810
  • @VladD we cut down his comp - and the session falls off due to timeout - Pavel Mayorov
  • @VladD if the user is remote - ask the admin to beat the VPN session - Pavel Mayorov