Subsonic 3 - 是否支持使用 IEnumerable.Contains 进行查询?
此操作失败并出现错误,不支持方法“Contains”。
List<int> usedID= new List<int> { 1, 2, 3 };
var f = WebPageContent.Find(x => !usedID.Contains(x.PageID));
看起来很奇怪,那么替代方法是什么?
这也不起作用:
var dd = from i in WebPageContent.All()
where !usedID.Contains(i.PageID)
select i;
这确实有效,但这是推荐的方法吗:
var table = new WebPageContentTable(_db.DataProvider);
var g = new SubSonic.Query.Select()
.From(table)
.Where(table.ID)
.In(usedID)
.Execute();
This fails with an error with the method "Contains" is not supported.
List<int> usedID= new List<int> { 1, 2, 3 };
var f = WebPageContent.Find(x => !usedID.Contains(x.PageID));
Seems odd so what's the alternative approach?
This doesn't work either:
var dd = from i in WebPageContent.All()
where !usedID.Contains(i.PageID)
select i;
This does but is it the recommended approach:
var table = new WebPageContentTable(_db.DataProvider);
var g = new SubSonic.Query.Select()
.From(table)
.Where(table.ID)
.In(usedID)
.Execute();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对 Subsonic/Subsonic 3 不了解,我建议您使用
任何
(或Contains
) 扩展方法并查看它是否受支持。Not knowing anything about Subsonic/Subsonic 3 I suggest that you use the
Any
(orContains
) extension method and see if it's supported.