Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
Created October 12, 2011 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbcwebdev/1282128 to your computer and use it in GitHub Desktop.
Save cbcwebdev/1282128 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment