ACP
ACP

Reputation: 35268

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

I have seen blogs and people saying Returning dataset/datatable from an ajax enabled 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?

Upvotes: 0

Views: 1360

Answers (1)

marc_s
marc_s

Reputation: 754973

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.

Upvotes: 1

Related Questions