我想用不同的键搜索我的数据库。根据输入,可能有 1 个键到 10 个键。有没有办法动态地将 OR/AND 子句添加到我的 Linq 查询中?
keys[k] // I have my keys in this array
var feedList = (from feed in ctx.Feed
where feed.content.contains(keys[0])
&& feed.content.contains(keys[1])
&& ... // continues with the keys.length
select new {
FeedId = feed.DuyuruId,
FeedTitle = feed.FeedTitle,
FeedContent = feed.FeedContents,
FeedAuthor = user.UserName + " " +User.UserSurname
}