我有一组域模型name
,desc
和users
(属于该组)收集LINQ到实体EF4
我试图让特定用户所属的所有组。这是我的LinQ声明:
var results = from p in AuthorizationService.UnitOfWork.Groups.FindAll()
where
(p.Users != null && p.Users.Select(u => u.Id).Contains(CurrentUser.Id))
select p.Name;
我收到以下错误,当我尝试执行查询
Cannot compare elements of type 'System.Collections.Generic.ICollection`1'. Only primitive types (such as Int32, String, and Guid) and entity types are supported.
任何帮助是appreciated.Thanks!
为什么不放弃最后一个Contains子句并将其包装到您的选择? – Rig
钻机,你能告诉我这个查询的样子吗? – Lavan