我首先使用實體框架代碼。我想查詢來自數據庫的實體對List對象。這適用於包含,但我怎樣才能將它與StartsWith?實體框架4.1 Linq包含和啓動與
這是我的代碼:
List<string> values = new List<string>();
values.Add("A");
values.Add("B");
context.Customer.Where(c => values.Contains(c.Name)).ToList();
我如何查詢針對與A或B開頭的所有客戶?
fyi更新與ef核心可悲地這得到本地評估 警告:Microsoft.EntityFrameworkCore.Query [20500 ] 無法翻譯LINQ表達式'where {from String text in __texts_0 where [d] .Entry.StartsWith([text])select [text] => Any()}'將被本地評估。 – 2018-02-23 13:37:22
@AnthonyJohnston [This may be related](https://stackoverflow.com/a/44372562/335858) – dasblinkenlight 2018-02-23 13:39:13