开发者

Entity variable get list based on where

开发者 https://www.devze.com 2023-02-04 14:46 出处:网络
I am very开发者_StackOverflow new to EF. So I have an entity variable, how do I say give me all categories that start with \'a\'?You could try something like below, EF should translate StartsWith to L

I am very开发者_StackOverflow new to EF. So I have an entity variable, how do I say give me all categories that start with 'a'?


You could try something like below, EF should translate StartsWith to LIKE

MyEFContext.SomeTable.Where(someTable => someTable.categories.StartsWith("a"));


var aCategories = from cat in context.Categories
                  where cat.StartsWith("a")
                  select cat;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号