Linq to XSD processing
For Typed Xml to Linq processing ,do i need to download Linq to XSD alpha i开发者_StackOverflownstaller or is it available in VS 2008 ? (I am using VS 2008 Professional edition).
The direct answer to your question: yes, you need to download the installer as it is not built-in to VS2008. freggel is correct that the project is no longer being developed -- but it is still useful!
LINQ-to-XSD has some distinct advantages over LINQ-to-Objects and LINQ-to-XML. I was so intrigued by it that in my recent 3-part series on meta-queries I devoted the whole third article to comparing and contrasting these three LINQ technologies. I reproduce below the executive summary showing that LINQ-to-XSD comes out on top (apologies for the double negatives in the table but it allows one to look for the preponderance of "Yes" answers as a measure of goodness).
Characteristic LINQ-to-Objects LINQ-to-XML LINQ-to-XSD Strongly typed Yes No Yes No explicit container coding needed No Yes Yes No code needed for slurping XML No Yes Yes Easier to read Yes No Yes .NET support Released Released Alpha stage .NET requirement 2.0 3.5 3.5
The third article provides a complete implementation of a demo project in each of the three LINQ technologies so you can see exactly how they fare against each other. Here are the links:
A Unified Approach to Multi-DataBase Query Templates (September 30, 2009) Part 1 of my 3-part series on the QueryPicker control.
How to build a Query Template Explorer (October 23, 2009) Part 2 presents the details to integrate the QueryPicker into applications both simple and complex, with screenshots and code samples.
Using Three Flavors of LINQ To Populate a TreeView (December 2, 2009) Part 3, for LINQ lovers, provides a treatment of how the QueryPicker populates its TreeView from XML using LINQ to Objects, LINQ to XML, and LINQ to XSD.
Apparently Microsoft killed the project, but open-sourced it and now it is on Codeplex:
http://linqtoxsd.codeplex.com
I think the project is no longer active and it is not available in Visual Studio 2008
You can find more info on this topic isLinq2XSD Dead?
if you reference the xsd file from inside thet xml file then you can get strongly typed linq iirc.
you then need to include the xsd into the project.
although i do have to say from experience that it is a lot easier to just cast the values as they come out. The xsd approach is a bit fragile and clunky i have found.
精彩评论