I have seen blogs and people saying Returning dataset/datatable from an ajax ena开发者_开发百科bled wcf service
is a bad idea.... I have gone through this Scott Hanselman's blog about datasets fr0m wcf...
So what is the alternative for dataset returned form ajax enabled wcf service?
Well, basically, on your server side (where your service method is implemented), either use straight ADO.NET SqlDataReader and assemble the data retrieved into custom classes, or use an ORM like Linq-to-SQL or the Entity Framework or NHibernate or ... or... or..... to do this job.
Then, when you need to return data, either return a List<MyClass>
or some other structure, which gets serialized into JSON or XML and doesn't carry the overhead of a whole DataSet/DataTAble.
精彩评论