我有一个Groups领域模型,其中包含name
、desc
和一组users
(属于该组)。
我正在尝试获取特定用户所属的所有组。这是我的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.
非常感谢您的帮助!