-
Notifications
You must be signed in to change notification settings - Fork 15
Home
The contents of this wiki is intended to preserve some of the original (but still valid) documentation Microsoft wrote in the early development of LinqToXsd. This wiki details the lower-level technical features of LinqToXsd.
The LINQ to XSD technology provides .NET developers with support for typed XML programming. LINQ to XSD contributes to the LINQ project (.NET Language Integrated Query); in particular, LINQ to XSD enhances the existing LINQ to XML technology. To get an idea, consider the following C# 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")
).Sum();
Using LINQ to XSD, .NET developers may instead write `typed’ code as follows:
(from item in purchaseOrder.Item
select item.Price * item.Quantity
).Sum();
LINQ to XSD facilitates XML schemas (XSD), which are automatically mapped to object models so that XML data may be processed in typed manner within the OO paradigm. To this end, the generated classes enforce various validation constraints imposed by the input schema. In this respect, LINQ to XSD is similar to existing technologies for so-called X/O mapping or XML data binding. An important aspect of LINQ to XSD though is its foundation on ‘XML objects’ as opposed to ‘plain objects’. That is, the object models, generated from XML schemas, provide XML semantics in terms of XML fidelity and programming idioms, thereby providing a better programming environment for XML-related development tasks.
To this end, the generated classes model typed views on untyped XML trees. LINQ to XSD enhances LINQ to XML. Familiar XML programming idioms of LINQ to XML are complemented by typed variations in LINQ to XSD. In particular, typed member access can be used in most cases, and untyped tree access is available as a last resort.
- Comprehensive and canonical XML-schema-to object-model mapping.
- The generated classes model typed views on XML trees.
- Typed descendant and ancestor axes on XML object types.
- Discoverable object models including tool tips for XML schema constraints.
-
Visual Studio integration through project templates with build tasks.NOT yet supported in this .NET Core port. - Command-line interface for mapping tool.
- Better intellisense for LINQ will imply better intellisense for LINQ to XSD.
- Better discoverability during object construction; cf.
XRoot
class. - Support of LINQ to XSD for the use in WebServices.
- Tool support (wizard) for adding schemas to project with customization.
- Automated schema normalization for common XSD organization/coding styles.
- Performance tuning: stay close to LINQ to XML figures.
- Improvement of DML for complicated content models; cf. ‘append’ semantics.
- Open bugs and work items on name/namespace mapping.
- Open bugs and work items on cast-time validation and handling of restricted types.
- Support for default elements currently disabled.
- Support for global and local validation based on forthcoming LINQ to XML support.
- Name normalization for Camel/Pascal style of capitalization.
- Streaming support based on forthcoming LINQ to XML support.
- Improved experience for object browsing and debugging.
- Multiple typed views on the same
XElement
instance.