Class ConcurrencyExtensions
- Namespace
- LinqToDB.Concurrency
- Assembly
- linq2db.dll
public static class ConcurrencyExtensions
- Inheritance
-
ConcurrencyExtensions
Methods
DeleteOptimisticAsync<T>(IDataContext, T, CancellationToken)
Performs record delete using optimistic lock strategy asynchronously. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular delete operation will be performed.
public static Task<int> DeleteOptimisticAsync<T>(this IDataContext dc, T obj, CancellationToken cancellationToken = default) where T : class
Parameters
dcIDataContextDatabase context.
objTEntity instance to delete.
cancellationTokenCancellationTokenAsynchronous operation cancellation token.
Returns
Type Parameters
TEntity type.
DeleteOptimisticAsync<T>(IQueryable<T>, T, CancellationToken)
Performs record delete using optimistic lock strategy asynchronously. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular delete operation will be performed.
public static Task<int> DeleteOptimisticAsync<T>(this IQueryable<T> source, T obj, CancellationToken cancellationToken = default) where T : class
Parameters
sourceIQueryable<T>Table source with optional filtering applied.
objTEntity instance to delete.
cancellationTokenCancellationTokenAsynchronous operation cancellation token.
Returns
Type Parameters
TEntity type.
DeleteOptimistic<T>(IDataContext, T)
Performs record delete using optimistic lock strategy. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular delete operation will be performed.
public static int DeleteOptimistic<T>(this IDataContext dc, T obj) where T : class
Parameters
dcIDataContextDatabase context.
objTEntity instance to delete.
Returns
- int
Number of deleted records.
Type Parameters
TEntity type.
DeleteOptimistic<T>(IQueryable<T>, T)
Performs record delete using optimistic lock strategy. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular delete operation will be performed.
public static int DeleteOptimistic<T>(this IQueryable<T> source, T obj) where T : class
Parameters
sourceIQueryable<T>Table source with optional filtering applied.
objTEntity instance to delete.
Returns
- int
Number of deleted records.
Type Parameters
TEntity type.
UpdateOptimisticAsync<T>(IDataContext, T, CancellationToken)
Performs record update using optimistic lock strategy asynchronously. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular update operation will be performed.
public static Task<int> UpdateOptimisticAsync<T>(this IDataContext dc, T obj, CancellationToken cancellationToken = default) where T : class
Parameters
dcIDataContextDatabase context.
objTEntity instance to update.
cancellationTokenCancellationTokenAsynchronous operation cancellation token.
Returns
Type Parameters
TEntity type.
UpdateOptimisticAsync<T>(IQueryable<T>, T, CancellationToken)
Performs record update using optimistic lock strategy asynchronously. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular update operation will be performed.
public static Task<int> UpdateOptimisticAsync<T>(this IQueryable<T> source, T obj, CancellationToken cancellationToken = default) where T : class
Parameters
sourceIQueryable<T>Table source with optional filtering applied.
objTEntity instance to update.
cancellationTokenCancellationTokenAsynchronous operation cancellation token.
Returns
Type Parameters
TEntity type.
UpdateOptimistic<T>(IDataContext, T)
Performs record update using optimistic lock strategy. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular update operation will be performed.
public static int UpdateOptimistic<T>(this IDataContext dc, T obj) where T : class
Parameters
dcIDataContextDatabase context.
objTEntity instance to update.
Returns
- int
Number of updated records.
Type Parameters
TEntity type.
UpdateOptimistic<T>(IQueryable<T>, T)
Performs record update using optimistic lock strategy. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise regular update operation will be performed.
public static int UpdateOptimistic<T>(this IQueryable<T> source, T obj) where T : class
Parameters
sourceIQueryable<T>Table source with optional filtering applied.
objTEntity instance to update.
Returns
- int
Number of updated records.
Type Parameters
TEntity type.
WhereKeyOptimistic<T>(IQueryable<T>, T)
Applies primary key and optimistic lock filters to query for specific record. Entity should have column annotated with OptimisticLockPropertyBaseAttribute, otherwise only primary key filter will be applied to query.
public static IQueryable<T> WhereKeyOptimistic<T>(this IQueryable<T> source, T obj) where T : class
Parameters
sourceIQueryable<T>Entity query.
objTEntity instance to take current lock field value from.
Returns
- IQueryable<T>
Query with filter over lock field.
Type Parameters
TEntity type.