Introduction to LINQ-to-XSD (basic usage) needed

Jun 18, 2009 at 6:56 PM

Following the instructions in the excellent readme.txt file, I have successfully "installed" LINQ-to-XSD in my project -- but I don't know how to proceed from here!  I have added my .xsd file to the project and seen the auto-generated classes in obj\debug\LinqToXsdSource.cs, so I'm sure everything works.  I don't actually know how to apply a schema when using LINQ-to-XML, though.

Where can I go for an extremely basic introduction to how LINQ-to-XSD is intended to be used, preferably with some example code or walkthrough tutorials?  I have had a look at the Sample projects provided with the LINQ-to-XSD source but they are already too advanced for me.  Basically, I need a LINQ-to-XSD 101 class for complete beginners!

Any help gratefully received,

Ed Graham

Jun 18, 2009 at 11:24 PM

Hmm....  Are you very good at Linq and XML Schemas?  Both help in understanding how this thing works. 

The examples didn't seem too terribly steep to me.  Here is perhaps a short primer based on my understanding and playing around with it for a bit.  Please do not take this as gospel as I just started with this thing as well.

Given an XSD, elements are objects and attributes are propeties.  Nested elements are nested objects which I prefer over the way the old XSD command line tool generated objects.  I believe this is a closer representation of the actual XML instance as defined by the XSD.  The simplest, e.g. (Leaf Node Elements) are typed according to there XSD type.

That is as simple as I can explain what is going on.  Does this hopefully clear things up for you?

PS -  I had an older set of code that did use the class generated by the XSD tool and I like this so much that I converted the entire thing to use LinqToXsd instead.




Jun 19, 2009 at 11:11 AM

Thanks for that, Jupiter -- I could certainly be better at both!  Your primer was much appreciated.

I have since found an overview document of LINQ-to-XSD from Microsoft in November 2006 that I found useful.  I have uploaded it to this site under the "Documentation" issue (Issue Tracker > Documentation), in case anyone else can make use of it.