Jan 13, 2010, 10:41 AM
Returning datatable cast as object from web service causes Circular Reference error
Hello,
I'm using a Store, JsonReader, and GridPanel. I'm using the HttpProxy of the store to call a webservice. I got this working just fine in an example, but when I switched the data from the hard-coded List<object> used in the examples to a datatable, I got the following error:
I'm using a Store, JsonReader, and GridPanel. I'm using the HttpProxy of the store to call a webservice. I got this working just fine in an example, but when I switched the data from the hard-coded List<object> used in the examples to a datatable, I got the following error:
A circular reference was detected while serializing an object of type \u0027System.Reflection.Module\u0027
I have a DataTable dt that is filled with information. I then cast it as the proper return type expected, Paging<object>:IEnumerable<DataRow> iEnumData = dt.AsEnumerable();
IEnumerable<object> iEnumObj = iEnumData.Cast<object>();
Paging<object> pagingObj = new Paging<object>(iEnumObj, intTotalRows));
return pagingObj
I know that the circular reference is caused by the json serialization of the ADO.NET objects (DataTable and DataRows), but I thought since I was casting it, the problem would be fixed. I know that I could just create a class and do a manual conversion from DataTable to class, then returning the Paging<MyNewClass>, but these DataTables are dynamic. This one call retrieves different structures. Any thoughts?