Show / Hide Table of Contents

Class TemporaryDbLock

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Inheritance
object
TemporaryDbLock
Implements
IAsyncDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: SuperOffice.CRM
Assembly: SoDataBase.dll
Syntax
public sealed class TemporaryDbLock : IAsyncDisposable

Properties

IsLocked

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public bool IsLocked { get; }
Property Value
Type Description
bool

Methods

CreateAsync(int, int, int, CancellationToken)

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public static Task<TemporaryDbLock> CreateAsync(int tableNumber, int key, int seconds = 600, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int tableNumber
int key
int seconds
CancellationToken cancellationToken
Returns
Type Description
Task<TemporaryDbLock>

DisposeAsync()

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

FlushAllTempDbLocksAsync(CancellationToken)

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public static Task<int> FlushAllTempDbLocksAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<int>

TryUpdateAsync()

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public Task<bool> TryUpdateAsync()
Returns
Type Description
Task<bool>

UpdateAsync()

Locking class for implementing concurrency of relatively quick (within one request) run time operations. using (var lock = new TemporaryDbLock(tableNumber, key) { if (!lock.IsValid) return; // You didn't get the lock, so return or continue. You must check if you actually got the lock.

// you have the lock, do stuff... lock.Update() // Will keep the lock alive, not timing out, while you work. .... }

Declaration
public Task UpdateAsync()
Returns
Type Description
Task

Implements

System.IAsyncDisposable

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top