I\'m reasonably new to NHibernate and everything has been going pretty well so far but I\'ve come across a problem I\'m not exactly sure of how to go about solving. Basicall
Creating custom dialect extensions is rather easy:
public class CustomFunctionsMsSql2005Dialect : MsSql2005Dialect
{
public CustomFunctionsMsSql2005Dialect()
{
RegisterFunction("calculatedistance",
new SQLFunctionTemplate(NHibernateUtil.Int32,
"CalculateDistance(?1, ?2, ?3, ?4)"));
}
}
Register it, like so:
CustomFunctionsMsSql2005Dialect, MyAssembly
Now you can use it like any other HQL function in queries like those created with session.CreateQuery()
.