views:

739

answers:

2

I am using Asp.NET MVC as a basic webservice for several searchengine type asp/ jquery sites. Database searching is straightforward:

Model - Sql Server FullText Sproc returning XML

View - N/a

Controller - Authorise user/ Parse input return Content (Model.XML)

The returned XML contains four resultsets - item list, category breakdown, related/ads items & paging numbers. The item, category & related lists all comprise several elements and attribs.

I am now looking for the best method to display the same info in an MVC view - both full and partials for jquery use - but am struggling to find the best solution. The only two I have come up with so far are to parse the XML using Linq ( should this be done in View or Controller?) or have a SProc returning resultsets and use NextResult method to fill multiple lists ( not that I 've worked out how to do that yet....)

All suggestions appreciated, thanks!

A: 

For parsing the xml - how about using XmlSerializer to deserialize an object graph?

Does it need to return xml? How about returning regular grids, that you can read over directly? For example, one option is to use ORM such as a LINQ-to-SQL DataContext - then you can just execute the generated method which gives you the data as objects.

Alternatively - perhaps render the xml via an xsl transform?

Marc Gravell
+1  A: 

Decided to run with XDocument(Linq-to-XML); with the PasteXmlAsXLinq Visual Studio addin taking the pain out of it!

I'll leave the ORM until Asp.net mvc rtm. By then should have a better idea (Entity/ Linq & Viewengine) on most suitable route for full MVC 'conversion'.