I'm trying to get an object back from an NHibernate query.
My method is as follows:
public Site GetSiteByHost(string host)
{
var result = _session.CreateCriteria<Site>()
.Add(SqlExpression.Like<Site>(g => g.URLName, host));
return result;
}
the problem is, result
is a type of HNibernate.ICriteria.
How can I get this to return a Site
object?
If I was doing this with LINQ to SQL it'd be something like .FirstOrDefault()
but that's not available with NHibernate... or is it?!?!