I am trying to use AJAX with Virtual Earth. One issue I am having is with transfering objects from the server to the client. I have created C# object on the server that look like the Virtual Earth objects (VELatLong, VELatLongRectangle etc) and I can serialize them to JASON and deserialize them on the client (using Sys.Serialization.JavaScriptSerializer.deserialize)
I can look at these objects in the debugger and they have the right properties, with the right values, but they are not the real object types. The Virtual Earth APIs validate parameters - e.g. if(VELatLongRectangle.prototype.isPrototypeOf(a)) - which my objects fail.
So is there an easy way to deserialize to the correct object types? (Have I missed a deserialize function which takes a type hint) or do I have to write a series of converter functions e.g. :
_2VELatLong:function(o)
{
if (o == null)
{
return null;
}
else
{
return new VELatLong(o.Latitude, o.Longitude);
}
}
--
David