Here is how you do it:
Step 1: In edmx
select dbo.DistanceBetween(@lat1,@long1,@lat2,@long2)
step 2: Import the function
- double click the
edmx
- In the Model Browser view, expand
GeoDataModel.Store (could be named different)
- expand
stored procedures /function
- double click
DistanceBetween
Scalars = Single
- Click OK
Step 3: In C#:
GeoDataEntities db = new GeoDataEntities();
var first = db.DistanceBetween(234, 2342, 424, 243).First().Value;
note that IsComposable="false" and no ReturnType and dont forget to add the :
select dbo.DistanceBetween(@lat1,@long1,@lat2,@long2)
Hope that help....