Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseRowNumberForPaging is not a valid

I'm using "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final" with SQL 2008 and according to some results found on Google, I just have to add the option to .UseRowNmberForPaging() when creating a new DBcontext. This was the solution for rc1-final but it doesn't seem to work for rc2-final.

When I add the option when configuring my service, it's not recognized.

Trying to paginate records on SQL Server 2008 with EF Core so this seems to be the recommended solution.

Here is the line I'm using to Configure the service:

services.AddDbContext<Data.Models.AC_MCLContext>(options =>
               options.UseSqlServer(connection).UseRowNumberForPaging()); 

Does anyone know how to use the row number for paging in EntityFramework Core rc2?

like image 996
T. Lee Avatar asked May 24 '16 01:05

T. Lee


1 Answers

A solution was given to me on another forum so I thought I'd share the answer in case anyone else ran into this issue.

The API now uses a nested closure pattern so the options should be configured as a nested structure like the example below.

        services.AddDbContext<Data.Models.AC_MCLContext>(options =>
               options.UseSqlServer(connection, 
               opt => opt.UseRowNumberForPaging()));
like image 135
T. Lee Avatar answered Sep 19 '22 15:09

T. Lee