开源框架.netCore DncZeus学习(二)配置连接

配置连接字符串,update-database,初始数据后,访问报错,提示offset错误。

.net Core中的EF访问sqlserver2008默认使用的是offset分页,这在sql2008上不支持。

.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<DncZeusDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection") ,b => b.UseRowNumberForPaging()));

加上红色部分,将使用传统的RowNumber分页。

猜你喜欢

转载自www.cnblogs.com/zhaogaojian/p/10164048.html