因为新版的EntityFrameworkCore默认使用的是SqlServer2012或以上版本的Sql语法分页,来提升性能。数据库
因此使用数据库的版本若是低于2012(如Sqlserver2008)须要显示的指定代码:性能
public class Startup { ... /// <summary> /// /// </summary> /// <param name="services"></param> public void ConfigureServices(IServiceCollection services) { services.AddDbContext<service.exercise.Database.SunnyTaskContext>(options => options.UseSqlServer(Configuration.GetConnectionString("SunnyTask"), b => b.UseRowNumberForPaging()));//【临时】链接老SqlServer数据库 } ... }