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
You could use SQL expression in your hibernate queries. Assuming you've mapped a Store type you could write the following query:
var result = session
.CreateCriteria()
.Add(Expression.Sql(
"dbo.CalculateDistance({alias}.Latitude, {alias}.Longitude, ?, ?) < ?",
new object[] {
-118.4104684d,
34.1030032d,
100
},
new IType[] {
NHibernateUtil.Double,
NHibernateUtil.Double,
NHibernateUtil.Int32
}
))
.List();