Show / Hide Table of Contents

    Class EntityFrameworkLock

    The distributed lock based on a PostgreSql table.

    Inheritance
    object
    DistributedLock
    TableBasedDistributedLock
    EntityFrameworkLock
    Implements
    IDistributedLock
    Inherited Members
    TableBasedDistributedLock.AcquireCoreAsync(CancellationToken)
    DistributedLock.AcquireAsync(CancellationToken)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    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
    TableBasedDistributedLock.ReleaseLockAsync(string)

    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 true if the lock was acquired, otherwise false.

    Overrides
    TableBasedDistributedLock.TryAcquireLockAsync(string)

    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.

    Overrides
    TableBasedDistributedLock.UpdateHeartbeatAsync(string)

    Implements

    IDistributedLock
    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini