I am trying to follow the example here …but get the exception:
‘System.Uri’ does not contain a definition for ‘GetDynamicJsonObject’ and no extension method ‘GetDynamicJsonObject’ accepting a first argument of type ‘System.Uri’ could be found (are you missing a using directive or an assembly reference?)
I have looked at every online example I can find but cannot figure out what am I missing here.
private void setTimeEstimates(ref List<Object> rides, string orig)
{
string dest, googleURL;
dynamic googleResults;
int driveTime; //in seconds
using (myEntities = new RamRideOpsEntities())
{
foreach (Ride ride in rides)
{
dest = interpretAddress(ride.PickupAddress);
googleURL = "http://maps.googleapis.com/maps/api/distancematrix/json" +
"?origins=" + orig +
"&destinations=" + dest +
"&mode=driving&sensor=false";
googleResults = new Uri(googleURL).GetDynamicJsonObject(); //EXCEPTION HERE!
driveTime = googleResults.result.duration;
ride.EstTime = driveTime + BASE_WAIT_TIME;
}
myEntities.SaveChanges();
}
}
Easy fix: forgot to add JsonUtils extension methods