Skip to content

Commit

Permalink
change rowversion to ulong (#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvreony committed Sep 4, 2023
1 parent 487baf6 commit 03b0e56
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Whipstaff.Core/Entities/ILongRowVersion.cs
Expand Up @@ -12,6 +12,6 @@ public interface ILongRowVersion
/// <summary>
/// Gets or sets the row version.
/// </summary>
long RowVersion { get; set; }
ulong RowVersion { get; set; }
}
}
12 changes: 6 additions & 6 deletions src/Whipstaff.EntityFramework/CompiledQueryFactory.cs
Expand Up @@ -24,7 +24,7 @@ public static class CompiledQueryFactory
/// <typeparam name="TDbSet">The type for the Database set.</typeparam>
/// <param name="dbSetSelector">Function to select the DBSet used for the compiled query.</param>
/// <returns>Compiled EF Query.</returns>
public static Func<TDbContext, CancellationToken, Task<Task<long>>> GetMaxRowVersionCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
public static Func<TDbContext, CancellationToken, Task<Task<ulong>>> GetMaxRowVersionCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
where TDbContext : DbContext
where TDbSet : class, ILongRowVersion
{
Expand All @@ -41,7 +41,7 @@ public static class CompiledQueryFactory
/// <typeparam name="TDbSet">The type for the Database set.</typeparam>
/// <param name="dbSetSelector">Function to select the DBSet used for the compiled query.</param>
/// <returns>Compiled EF Query.</returns>
public static Func<TDbContext, long> GetMaxRowVersionCompiledQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
public static Func<TDbContext, ulong> GetMaxRowVersionCompiledQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
where TDbContext : DbContext
where TDbSet : class, ILongRowVersion
{
Expand All @@ -56,11 +56,11 @@ public static class CompiledQueryFactory
/// <typeparam name="TDbSet">The type for the Database set.</typeparam>
/// <param name="dbSetSelector">Function to select the DBSet used for the compiled query.</param>
/// <returns>Compiled EF Query.</returns>
public static Func<TDbContext, long, long, IAsyncEnumerable<TDbSet>> GetWhereRowVersionBetweenCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
public static Func<TDbContext, ulong, ulong, IAsyncEnumerable<TDbSet>> GetWhereRowVersionBetweenCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
where TDbContext : DbContext
where TDbSet : class, ILongRowVersion
{
return EF.CompileAsyncQuery((TDbContext context, long min, long max) => dbSetSelector.Compile()(context)
return EF.CompileAsyncQuery((TDbContext context, ulong min, ulong max) => dbSetSelector.Compile()(context)
.Where(entity => entity.RowVersion >= min && entity.RowVersion <= max));
}

Expand All @@ -71,11 +71,11 @@ public static class CompiledQueryFactory
/// <typeparam name="TDbSet">The type for the Database set.</typeparam>
/// <param name="dbSetSelector">Function to select the DBSet used for the compiled query.</param>
/// <returns>Compiled EF Query.</returns>
public static Func<TDbContext, long, IAsyncEnumerable<TDbSet>> GetWhereRowVersionGreaterThanCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
public static Func<TDbContext, ulong, IAsyncEnumerable<TDbSet>> GetWhereRowVersionGreaterThanCompiledAsyncQuery<TDbContext, TDbSet>(System.Linq.Expressions.Expression<Func<TDbContext, DbSet<TDbSet>>> dbSetSelector)
where TDbContext : DbContext
where TDbSet : class, ILongRowVersion
{
return EF.CompileAsyncQuery((TDbContext context, long rowVersion) => dbSetSelector.Compile()(context).Where(entity => entity.RowVersion > rowVersion));
return EF.CompileAsyncQuery((TDbContext context, ulong rowVersion) => dbSetSelector.Compile()(context).Where(entity => entity.RowVersion > rowVersion));
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Whipstaff.EntityFramework/Extensions/DbSetExtensions.cs
Expand Up @@ -100,8 +100,8 @@ public static class DbSetExtensions
/// <returns>Queryable representing the rows to return.</returns>
public static IQueryable<TEntity> GetRowsGreaterThanAndLessThanOrEqualToRowVersions<TEntity>(
this DbSet<TEntity> dbSet,
long greaterThanRowVersion,
long maxRowVersion,
ulong greaterThanRowVersion,
ulong maxRowVersion,
int takeRecords)
where TEntity : class, ILongRowVersion
{
Expand Down Expand Up @@ -266,7 +266,7 @@ public static class DbSetExtensions
/// <returns>Queryable representing the rows to return.</returns>
public static IQueryable<TEntity> GetRowsGreaterThanRowVersion<TEntity>(
this DbSet<TEntity> dbSet,
long id)
ulong id)
where TEntity : class, ILongRowVersion
{
return dbSet.Where(x => x.RowVersion > id);
Expand All @@ -282,7 +282,7 @@ public static class DbSetExtensions
/// <returns>Queryable representing the rows to return.</returns>
public static IQueryable<TEntity> GetRowsGreaterThanRowVersion<TEntity>(
this DbSet<TEntity> dbSet,
long rowVersion,
ulong rowVersion,
int takeRecords)
where TEntity : class, ILongRowVersion
{
Expand Down
2 changes: 1 addition & 1 deletion src/Whipstaff.Testing/EntityFramework/DbSets/BaseDbSet.cs
Expand Up @@ -27,6 +27,6 @@ public class BaseDbSet : IIntId, IModifiable, ILongRowVersion
public DateTimeOffset Modified { get; set; }

/// <inheritdoc/>
public long RowVersion { get; set; }
public ulong RowVersion { get; set; }
}
}
Expand Up @@ -22,6 +22,6 @@ public class FakeLongIdTableDbSet : ILongId, IModifiable, ILongRowVersion
public DateTimeOffset Modified { get; set; }

/// <inheritdoc/>
public long RowVersion { get; set; }
public ulong RowVersion { get; set; }
}
}

0 comments on commit 03b0e56

Please sign in to comment.