我试着从我的表像这样的代码NHibernate的查询过
IList<Product> res = sess.QueryOver<Product>()
.Select(x =>x.name)
.List<Product>();
与此代码,但在运行时我得到这个没有错误,只选择一些字段:“无法执行查找[SQL:SQL不可用]“值”Prod1不是类型SympleFlhLINQ.Product并且不能在此泛型集合上使用“。
而且会是非常好的,如果有人告诉我怎样可以获取唯一的产品名称和引用的类别名称宽度像这样
IList<Product> res = sess.QueryOver<Product>()
.Select(x =>x.name)
.Select(x=>x.Cat.CategoryName)
.List<Product>();
你需要一个' IList'或者你可以使用DTO吗? –
2012-07-30 22:52:16
DTO你的意思是使用类型像公共类ProductCollection:列表 { } ?? –
maxs87
2012-08-02 11:46:10