public void ModelToEntityConcurrenyProcessing(IConcurrency entity, IConcurrency model) { if (entity == null && model == null) { return; } if (entity != null && model == null) { throw new Exception("Add timestamp to model"); } var currentTimestamp = entity.Timestamp; entity.Timestamp = model.Timestamp; // see if has changed model.Timestamp = currentTimestamp; }
public static async Task <IConcurrency <TKey> > FindByIdAndConcurrencyStampAsync <TKey>(this IQueryable <IConcurrency <TKey> > queryable, IConcurrency <TKey> other, CancellationToken cancellationToken = default) where TKey : IEquatable <TKey> => await Task.Run(() => queryable.FindByIdAndConcurrencyStamp(other), cancellationToken);
public static IConcurrency <TKey> FindByIdAndConcurrencyStamp <TKey>(this IQueryable <IConcurrency <TKey> > queryable, IConcurrency <TKey> other) where TKey : IEquatable <TKey> => queryable.FindByIdAndConcurrencyStamp(other.Id, other.ConcurrencyStamp);
public static Expression <Func <IConcurrency <TKey>, bool> > HasIdAndConcurrencyStampExpression <TKey>(this IConcurrency <TKey> concurrency, IConcurrency <TKey> other) where TKey : IEquatable <TKey> => _ => concurrency.HasIdAndConcurrencyStamp(other);
public static Expression <Func <IConcurrency <TKey>, bool> > HasIdAndConcurrencyStampExpression <TKey>(this IConcurrency <TKey> concurrency, TKey id, string concurrencyStamp) where TKey : IEquatable <TKey> => _ => concurrency.HasIdAndConcurrencyStamp(id, concurrencyStamp);
public static bool HasIdAndConcurrencyStamp <TKey>(this IConcurrency <TKey> concurrency, IConcurrency <TKey> other) where TKey : IEquatable <TKey> => concurrency.HasIdAndConcurrencyStamp(other.Id, other.ConcurrencyStamp);
public static bool HasIdAndConcurrencyStamp <TKey>(this IConcurrency <TKey> concurrency, TKey id, string concurrencyStamp) where TKey : IEquatable <TKey> => concurrency.Id.Equals(id) && concurrency.ConcurrencyStamp.Equals(concurrencyStamp);