Sunday, March 11, 2012

Web Services with Inherited Types, Missing __Type

By Default the WebService returns JSON. to generate botht the class use the GenerateScriptType Attribute either in your method or the webservice. For Ex:

[GenerateScriptType(typeof(BaseObject))]
[GenerateScriptType(typeof(FancyObject))]
[WebMethod()]
public BaseObject GetMyObject()
{
////
}


That worked great! I was wondering how the GenerateScriptType attribute worked! I had originally decorated my inherited classes with the attribute but not the webmethod itself.

Thanks!


Would you mind mark it as answer.

No comments:

Post a Comment