I need to create a query with C # queryOver (Nhibernate), to add more than one column. Example in pure sql:
SELECT SUM(coluna1 + coluna2 + coluna3 + coluna4)
FROM tabela
First I did it this way:
Tabela tabela = null;
Session.QueryOver<Tabela>(() => tabela)
.Select(Projections.Sum<Tabela>(t => t.coluna1))
.Select(Projections.Sum<Tabela>(t => t.coluna2))
.Select(Projections.Sum<Tabela>(t => t.coluna3))
.Select(Projections.Sum<Tabela>(t => t.coluna4))
But in this way I am adding each column and generating 4 columns, I would like to add all of them and generate a single column.