A.4 The Oracle .NET Provider
There are currently two native Oracle providers. Microsoft provides a native Oracle provider that uses the Oracle Call Interface (OCI), provides structures that represent basic Oracle data types, and is optimized for Oracle 8 i . This provider can be downloaded from http://msdn.microsoft.com (search for Oracle .NET) but is included with the .NET Framework 1.1 (see Table A-7). It doesn't support Oracle 7.3. To use these types, add a reference to the System.Data.OracleClient.dll assembly in your Visual Studio .NET project, or use the following csc.exe command line:
csc /r:System.Data.OracleClient.dll codeFile.cs
Table A-7. Oracle .NET provider classes
A.5 The ODP.NET Provider
Oracle also provides its own native provider called ODP.NET (see Table A-8). It can connect to an Oracle 8 i or later database and be downloaded from http://otn.oracle.com/tech/ windows /odpnet with documentation and code samples. The ODP.NET provider provides the standard connection-based and type-specific classes, and is actually quite similar in structure to the Microsoft provider for Oracle.
To use the ODP.NET types, add the reference to the Oracle.DataAccess.dll assembly in your Visual Studio .NET project, or use the following command line when compiling:
csc /r:Oracle.DataAccess.dll codeFile.cs
Table A-8. ODP.NET provider classes
Appendix B. ADO.NET XML Extensions
Microsoft defines two namespaces for configuring DataSet schema files: codegen ( urn:schemas-microsoft-com:xml-msprop ) and msdata ( urn:schemas-microsoft-com:xml-msdata ). These namespaces extend the XSD format, allowing it to represent additional database-specific properties and allowing you to configure how typed DataSets are generated. In addition, the diffgr , or DiffGram namespace ( urn:schemas-microsoft-com:xml-diffgram-v1 ), defines attributes that provide a way for XML documents to track DataSet changes and row insertions and deletions.
The structure of the XSD file for a DataSet is as follows :
<?xml version="1.0" encoding="utf-8"?> <xs:schema id=" DataSetName "> <xs:element name=" DataSetName " > <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name=" DataTableName " > <xs:complexType> <xs:sequence> <xs:element name=" FieldName " /> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> <xs:unique name=" ConstraintName " /> <xs:keyref name=" RelationName " /> </xs:element> </xs:schema>
The structure of the DiffGram format is shown next . All DiffGrams contains three sections: the current data, the original data, and any errors.
<?xml version="1.0"?> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- Data goes here. Changed rows are flagged. --> <diffgr:before> <!-- Contains the original data. --> </diffgr:before> <diffgr:errors> <!-- Contains error information. --> </diffgr:errors> </diffgr:diffgram>
For specific examples that show how you can create a typed DataSet and refine its schema, refer to Chapter 4. For an introduction to the DiffGram format and XML serialization with the DataSet , refer to Chapter 7.