I have an entity:
class Entity
{
public int A { get; set; }
public int B { get; set; }
public int C { get; set; }
}
I want to select sum of (A-B-C). So I want to run sql like this:
SELECT SUM(A-B-C) FROM Entity
I can achieve it by SqlProjection:
QueryOver.Of<Entity>().Select(Projections.SqlProjection("SUM(A-B-C) AS total", new[] { "total" }, new IType[] { NHibernateUtil.Int32 }));
But I do not want to use strings. How it can be done in other way?