views:

71

answers:

1

I know that you can do this easily with HQL using the following syntax:

"select new ItemRow(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?

+1  A: 

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>();
dotjoe
Let me try that, I'll get back to you.
Newbie
Bingo! That did it!
Newbie