0

我有个问题。当我尝试时,我想从对象中获取集合

 UserProfile user = _session.Query<UserProfile>()
                            .Where(x => x.Email == email)
                            .FirstOrDefault();

用户有一组角色,没关系。但是当我尝试这个时:

 IList<UserRole> role = _session.Query<UserProfile>()
                                .Where(x => x.Email == email)
                                .Select(x => x.Roles).FirstOrDefault();

它不起作用我收到一个错误:

 could not execute query[SQL: SQL not available]
4

1 回答 1

0

试着像这样写你的查询

var roles = (from u in _session.Query from r in u.Roles select r).ToList();

于 2012-12-10T19:14:47.860 回答