开发者

Alternative for dataset/datatable returned from ajax enabled wcf service?

开发者 https://www.devze.com 2022-12-21 18:09 出处:网络
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 blogabout datasets fr0m wc

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消