You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-16Lines changed: 24 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# SqlAppLockHelper
2
-
A very lightweight library that provides and easy to use API for the Sql Server Application Lock Stored Procs
3
-
(e.g. sp_getapplock & sp_releaseapplock). These stored procs provide a robust & efficient distributed locking
4
-
capability using Sql Server. And this library exposes this in an easy to use API using custom extension methods
5
-
on the SqlConnection and SqlTransaction classes of the existing SqlClient.
1
+
# SqlAppLockHelper -- Easy Distributed Mutex/Locking with Sql Server
2
+
An ultra lightweight library that provides and easy to use API for a robust distributed mutex locking capability that leverages
3
+
Sql Server (e.g. sp_getapplock & sp_releaseapplock). Sql Server provides a very robust & efficient distributed mutex/locking
4
+
capability and this library exposes this in an easy to use C# .Net Standard API using custom extension methods
5
+
on the SqlConnection and SqlTransaction classes of the SqlClient libraries.
6
6
7
7
#### SqlClient Namespaces:
8
8
There are two namespaces for SqlClient, and this library supports both:
@@ -20,10 +20,13 @@ There are two scopes for Locks that are supported:
20
20
21
21
#### Usage Notes:
22
22
- The generally recommended approach is to use the *Transaction* scope because it is slightly safer (e.g. more resilient agains
23
-
abandoned locks).
24
-
- The LockTimeout value is the value for which Sql Server will try and wait for Lock Acquisition. By specifying Zero
23
+
abandoned locks) by allowing the Locks to automatically expire with the Transaction; and is the default behavior of Sql Server.
24
+
- However the *Session* scope is reliably implemented via IDisposable/IAsyncDisposable C# interfaces leaving
25
+
the main residual risk of Database communication or Network issues, whereby if we can't communicate with the DB then we can't explicity release the lock.
26
+
- The lock _acquisition timeout_ value is the value (in seconds) for which Sql Server will try and wait for Lock Acquisition. By specifying Zero
25
27
(0 seconds) then Sql Server will attempt to get the lock but immediately fail lock acquisition and return if it cannot
26
28
acquire the lock.
29
+
- All locks are acquired as Exclusive locks for true _distributed mutex_ functionality.
0 commit comments