Based on a parameter I would like to select a constant value into a field using NHibernate ICriteria
The desired sql could be like
SELECT ID, 'ConstantTile' Title FROM Table
The only way I can se how its done is using Projections.Conditional which always returns true, but there must be a smarter way
My code for returning a string is:
public static IProjection GetBoolResult(string desiredResult)
{
return Projections.Conditional(Restrictions.Ge("ID",0),
Projections.Constant(desiredResult, NHibernateUtil.String),
Projections.Constant("", NHibernateUtil.String));
}
The Projections.Alias and Projections.Constant gave the desired result