Class EntityFrameworkLock
The distributed lock based on a PostgreSql table.
Implements
Inherited Members
Namespace: Silverback.Lock
Assembly: Silverback.Storage.EntityFramework.dll
Syntax
public class EntityFrameworkLock : TableBasedDistributedLock, IDistributedLock
Constructors
EntityFrameworkLock(EntityFrameworkLockSettings, IServiceScopeFactory, ISilverbackLogger<EntityFrameworkLock>)
Initializes a new instance of the EntityFrameworkLock class.
Declaration
public EntityFrameworkLock(EntityFrameworkLockSettings settings, IServiceScopeFactory serviceScopeFactory, ISilverbackLogger<EntityFrameworkLock> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityFrameworkLockSettings | settings | The lock settings. |
| IServiceScopeFactory | serviceScopeFactory | The IServiceScopeFactory. |
| ISilverbackLogger<EntityFrameworkLock> | logger | The logger. |
Methods
ReleaseLockAsync(string)
Releases the lock.
Declaration
protected override Task ReleaseLockAsync(string handlerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | handlerName | The name of the current handler. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
Overrides
TryAcquireLockAsync(string)
Tries to acquire the lock.
Declaration
protected override Task<bool> TryAcquireLockAsync(string handlerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | handlerName | The name of the current handler. |
Returns
| Type | Description |
|---|---|
| Task<bool> | A Task representing the asynchronous operation. The result is |
Overrides
UpdateHeartbeatAsync(string)
Updates the last heartbeat of the lock.
Declaration
protected override Task UpdateHeartbeatAsync(string handlerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | handlerName | The name of the current handler. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |