当我在Linq-to-NHibernate中使用这样的子查询时,我收到错误“Unhanded expression type 1000”。 This link包含相同的问题,但没有提供任何适当的解决方案。
有人知道任何解决方案吗?我正在使用NHibernate 2.1.2。我知道NH3中的新LINQ提供程序有很多改进,但我担心我无法使用NHibernate 3,因为我通过Castle ActiveRecord使用NHibernate。
var innerQuery = from obj1 in ActiveRecordLinq.AsQueryable<TypeA>()
where
obj1.Prop1 == "abc"
select
obj1;
var outerQuery = from obj2 in ActiveRecordLinq.AsQuerable<TypeB>()
where
obj2.Prop2 == "def"
&&
innerQuery.Contains(obj2.TypeAProp)
select
obj2;
答案 0 :(得分:0)
不是真正的答案,但我会升级到NH3或者使用HQL。众所周知,NH2.x中的LINQ有限。