I know that you can do this easily with HQL using the following syntax:
"select new ItemRow开发者_Go百科(item.id, item.name) from ..."
In this example, the ItemRow need not be a persistent class that has its own mapping class.
But how can we accomplish the same using ICriteria?
Pretty sure that is equivalent to...
.SetProjection(Projections.ProjectionList()
.Add(Projections.Property("item.id"), "id")
.Add(Projections.Property("item.name"), "name"))
.SetResultTransformer(Transformers.AliasToBean<ItemRow>())
.List<ItemRow>();
精彩评论