配置連接字符串,update-database,初始數據后,訪問報錯,提示offset錯誤。因為本機上使用的sql2008。
.net Core 2.X中的EF訪問sqlserver2008默認使用的是offset分頁,這在sql2008上不支持。
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddDbContext<DncZeusDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection") ,b => b.UseRowNumberForPaging()));
加上紅色部分,將使用傳統的RowNumber分頁。
