1. 程式人生 > >開源框架.netCore DncZeus學習(二)配置連線

開源框架.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分頁。