Skip to content

Commit

Permalink
Obsolete UseRowNumberForPaging
Browse files Browse the repository at this point in the history
Fixes #18667
  • Loading branch information
ajcvickers committed Nov 1, 2019
1 parent c9d02c7 commit 8a636c0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public SqlServerDbContextOptionsBuilder([NotNull] DbContextOptionsBuilder option
/// <summary>
/// Use a ROW_NUMBER() in queries instead of OFFSET/FETCH. This method is backwards-compatible to SQL Server 2005.
/// </summary>
[Obsolete("Row-number paging is no longer supported. See https://ak.ms/AA6h122 for more information.")]
public virtual SqlServerDbContextOptionsBuilder UseRowNumberForPaging(bool useRowNumberForPaging = true)
=> WithOption(e => e.WithRowNumberPaging(useRowNumberForPaging));

Expand Down
2 changes: 2 additions & 0 deletions test/EFCore.SqlServer.FunctionalTests/LoggingSqlServerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public void Logs_context_initialization_row_number_paging()
{
Assert.Equal(
ExpectedMessage("RowNumberPaging " + DefaultOptions),
#pragma warning disable 618
ActualMessage(s => CreateOptionsBuilder(s, b => ((SqlServerDbContextOptionsBuilder)b).UseRowNumberForPaging())));
#pragma warning restore 618
}

protected override DbContextOptionsBuilder CreateOptionsBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ protected virtual DbContextOptions CreateOptions(SqlServerTestStore testStore, b

if (rowNumberPaging)
{
#pragma warning disable 618
new SqlServerDbContextOptionsBuilder(builder).UseRowNumberForPaging();
#pragma warning restore 618
}

return builder.Options;
Expand Down
2 changes: 2 additions & 0 deletions test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,9 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
.EnableServiceProviderCaching(false)
.UseSqlServer(
SqlServerTestStore.CreateConnectionString("RowNumberPaging_Owned"),
#pragma warning disable 618
b => b.UseRowNumberForPaging());
#pragma warning restore 618
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public static SqlServerDbContextOptionsBuilder ApplyConfiguration(this SqlServer
var offsetSupport = TestEnvironment.GetFlag(nameof(SqlServerCondition.SupportsOffset)) ?? true;
if (!offsetSupport)
{
#pragma warning disable 618
optionsBuilder.UseRowNumberForPaging();
#pragma warning restore 618
}

optionsBuilder.ExecutionStrategy(d => new TestSqlServerRetryingExecutionStrategy(d));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public void Can_add_extension_with_legacy_paging()
{
var optionsBuilder = new DbContextOptionsBuilder<DbContext>();

#pragma warning disable 618
optionsBuilder.UseSqlServer("Database=Kilimanjaro", b => b.UseRowNumberForPaging());
#pragma warning restore 618

var extension = optionsBuilder.Options.Extensions.OfType<SqlServerOptionsExtension>().Single();

Expand Down
4 changes: 4 additions & 0 deletions test/EFCore.SqlServer.Tests/SqlServerOptionsExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public void Changing_RowNumberPagingEnabled_when_UseInternalServiceProvider_thro
{
Assert.Equal(
CoreStrings.SingletonOptionChanged(
#pragma warning disable 618
nameof(SqlServerDbContextOptionsBuilder.UseRowNumberForPaging),
#pragma warning restore 618
nameof(DbContextOptionsBuilder.UseInternalServiceProvider)),
Assert.Throws<InvalidOperationException>(() => context.Model).Message);
}
Expand Down Expand Up @@ -92,7 +94,9 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (_rowNumberPagingEnabled)
{
#pragma warning disable 618
b.UseRowNumberForPaging();
#pragma warning restore 618
}
});
}
Expand Down

0 comments on commit 8a636c0

Please sign in to comment.