public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
public IList<Location> NearbyLocations(decimal latitude, decimal longitude, int distance, int excludeLocationId)
{
var criteria = Session.CreateSQLQuery("exec NearbyLocations @Latitude=:latitude, @Longitude=:longitude, @Distance=:distance, @ExcludeId=:excludeid");
 
criteria.SetDecimal("latitude", latitude);
criteria.SetDecimal("longitude", longitude);
criteria.SetInt32("distance", distance);
criteria.SetInt32("excludeid", excludeLocationId);
criteria.AddEntity(typeof (Location));
criteria.SetCacheable(true);
 
var results = criteria.List<Location>().ToList();
 
return results;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.