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;
        }
示例#2
0
 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);
示例#3
0
 public static IConcurrency <TKey> FindByIdAndConcurrencyStamp <TKey>(this IQueryable <IConcurrency <TKey> > queryable, IConcurrency <TKey> other)
     where TKey : IEquatable <TKey> => queryable.FindByIdAndConcurrencyStamp(other.Id, other.ConcurrencyStamp);
示例#4
0
 public static Expression <Func <IConcurrency <TKey>, bool> > HasIdAndConcurrencyStampExpression <TKey>(this IConcurrency <TKey> concurrency, IConcurrency <TKey> other)
     where TKey : IEquatable <TKey> => _ => concurrency.HasIdAndConcurrencyStamp(other);
示例#5
0
 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);
示例#6
0
 public static bool HasIdAndConcurrencyStamp <TKey>(this IConcurrency <TKey> concurrency, IConcurrency <TKey> other)
     where TKey : IEquatable <TKey> => concurrency.HasIdAndConcurrencyStamp(other.Id, other.ConcurrencyStamp);
示例#7
0
 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);