LINQ to XSD Preview

28 בנובמבר 2006

אין תגובות

After working sometime with LINQ this becomes quite a missing feature. This will make my life way easier working via xml

What is LINQ to XSD?


LINQ to XSD provides .NET developers with support for typed XML programming on top of LINQ to XML. While the LINQ to XML programmer operates on generic XML trees, the LINQ to XSD programmer operates on typed XML trees — instances of .NET types that model the XML types of a specific XML schema (XSD). To get an idea, consider the following C#3.0 fragment for a LINQ to XML query that computes the total over the items in a XML tree for a purchase order:


     (from item in purchaseOrder.Elements("Item")

      select (double)item.Element("Price")

           * (int)item.Element("Quantity")



Using LINQ to XSD, the query is written in a much clearer and type-safe way:


     (from item in purchaseOrder.Item

      select item.Price * item.Quantity



LINQ to XSD can be used whenever you have an XML schema available, or you are willing to infer a schema from the XML data at hand. LINQ to XSD is integrated into Visual Studio; so you just tag an XML schema as an ‘LINQ to XSD schema’, build your project, and the automatically derived object model is then part of your solution — just as if XML schemas were .NET types.



הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *