我正在使用SqlKata創(chuàng)建動(dòng)態(tài) SQL 查詢。我有一個(gè)條件列表,存儲(chǔ)在我的數(shù)據(jù)庫(kù)中,這些條件是根據(jù)我的業(yè)務(wù)規(guī)則生成的。這是我的代碼示例:var list = new List<Query>();foreach(var rule in rules){ var q = new Query() .Where(x=> x.Where("Price", "<", rule.Price).OrWhere("GoodsType", "=", rule.Type)); list.Add(q);}現(xiàn)在我想將這個(gè)列表項(xiàng)連接在一起,但沒(méi)有一個(gè)Where()擴(kuò)展重載接受Query類型參數(shù)。有沒(méi)有辦法將 where 子句連接在一起?這是我需要生成的預(yù)期查詢的一個(gè)非常小的部分。select * from ship_schedule where Path = @path and scheduleDate= @DateAND (FD.IssueType ='O' OR fd.Path!='ILMTOP' OR (fd.Path='ILMTOP' AND F.carrier !='MAL'))AND (FD.IssueType ='O' OR fd.Path!='TOPILM' OR (fd.Path='ILMTOP' AND F.carrier !='MAL'))我需要?jiǎng)?chuàng)建查詢的第二行到最后。
如何在 SqlKata 中將多個(gè) WHERE 子句連接在一起?
翻翻過(guò)去那場(chǎng)雪
2021-07-09 14:03:15