Setting up .NET Applications to Write LINQ to XML
Queries on XML Data
You can set up your .NET application with selected XML
documents and references and then write LINQ to XML
queries on the XML data in any of the following
locations:
Your DB2® database
An XML schema in the XML Schema Repository of
your DB2 database
An XML file in the file system
You can use this feature in the following types of .NET
applications:
Windows applications
ASP.NET Web applications
XML Web services applications
XAML applications
Workflow applications
This feature is available both for stand-alone XML documents
and for XML documents and XML schemas on the following data
servers:
DB2 for Linux®, UNIX®,
and Windows®, Version 9.1 or later
DB2 for z/OS®, Version 9
Prerequisites:
The Microsoft .NET Framework version 3.5 must be
installed in Visual Studio.
The .NET application must be open in the Solution Explorer.
To set up a .NET application to write LINQ
to XML queries on XML data:
In the Solution Explorer, right-click the project node of
your application, and then select Add IBM XML
Reference on the shortcut menu.
If you use an XML schema as the XML source, a sample XML document is
generated from the schema. If you use a document as the XML source,
an XML schema is generated for the XML document.
Both the XML document file and the XML schema file are copied
to the directory of the Visual Studio project. References to both
files are added to the project.
Sample code for how to write a LINQ to XML query on the XML document
is added to your Visual Studio project.
If you select to generate a mapping class, both the mapping
class and its corresponding sample code are generated and
added to the project.
If you do not generate a mapping class, the sample code is
generated by using an IEnumerable collection that is filled
with anonymous objects.