• Topic
  • Discussion
  • UdaWikiWeb.DevelopingADONetApps(Last) -- Owiki? , 2016-08-19 14:59:53 Edit owiki 2016-08-19 14:59:53

    Developing an Application with the ADO.NET Data Provider

    The namespaces for our ADO.NET Data Providers are:

    100% Managed Multi-Tier Generic Client ADO.NET Provider OpenLink.Data.GenericClient
    100% Managed Single-Tier ADO.NET Provider for Microsoft SQL Server Data Sources OpenLink.Data.SQLServer
    100% Managed Single-Tier ADO.NET Provider for Sybase Data Sources OpenLink.Data.Sybase
    100% Managed Single-Tier ADO.NET Provider for Virtuoso Data Sources OpenLink.Data.Virtuoso
    Partially Managed Single-Tier ADO.NET Provider for ODBC Data Sources OpenLink.Data.OdbcClient

    An ADO.NET data provider provides functionality for connecting to a data source, executing commands, and retrieving results. Those results can be processed directly, or placed in an ADO.NET DataSet for further processing while in a disconnected state. While in the DataSet, data can be exposed to the user, combined with other data from multiple sources, or passed remotely between tiers. Any processing performed on the data while in the DataSet can then be reconciled to the data source.

    All .NET data providers are designed to be lightweight. They consist of a minimal layer between the data source and your code. This extends functionality without sacrificing performance.

    There are four core objects that make up a .NET data provider. The following table describes those objects and their function.

    Table: 6.2.1. Core Classes

    Object Description
    Connection Establishes a connection to a specific data source and can begin a Transaction.
    Command Executes a command at a data source, and exposes Parameters.
    DataReader Exposes and reads a forward-only stream of data from a data source.
    DataAdapter Populates a DataSet and resolves updates with the data source.

    Along with the core classes listed in the preceding table, a .NET data provider also contains the classes listed in the following table.

    Table: 6.2.2. Additional Classes

    Object Description
    ClientPermission Provided for .NET data provider code access security attributes.
    CommandBuilder A helper object that will automatically generate command properties of a DataAdapter or will derive parameter information from a stored procedure and populate the Parameters collection of a Command object.
    Error Exposes the information from a warning or error returned by a data source.
    Exception Returned when an error is encountered at the data source. For an error encountered at the client, .NET data providers throw a .NET Framework exception.
    Parameter Defines input, output, and return value parameters for commands and stored procedures.
    Transaction Enables you to enlist commands in transactions at the data source.

    During the installation process the OpenLink .Net Data Provider is registered in the system GAC (Global Assembly Cache) enabling it for use by .Net applications. To use our ADO.NET Data Providers, the application must add an imports or using statement for the .Net Data Provider namespace, as the following code illustrates:

    [Visual Basic]
    Imports OpenLink.Data.GenericClient     // Managed Multi-Tier Generic Client
    //     or
    Imports OpenLink.Data.SQLServer         // Managed Microsoft SQL Server
    //     or
    Imports OpenLink.Data.Sybase            // Managed Sybase
    //     or
    Imports OpenLink.Data.OdbcClient        // Unmanaged ODBC based
    
    [C#]
    using OpenLink.Data.GenericClient;      // Managed VDB Generic Multi-Tier
    //     or
    using OpenLink.Data.SQLServer;          // Managed Microsoft SQL Server
    //     or
    using OpenLink.Data.Sybase;             // Managed Sybase 
    //     or
    using OpenLink.Data.Virtuoso;           // Managed Virtuoso
    //     or
    using OpenLink.Data.OdbcClient;         // Unmanaged ODBC based
    


    You must also include a reference to the .DLL when you compile your code. For example, if you are compiling a Microsoft® Visual C# program, your command line should include:

    csc /r:OpenLink.Data.GenericClient.dll  ; Managed VDB Generic Multi-Tier
    ;     or
    csc /r:OpenLink.Data.SQLServer.dll      ; Managed Microsoft SQLServer
    ;     or
    csc /r:OpenLink.Data.Virtuoso.dll       ; Managed Virtuoso
    ;     or
    csc /r:OpenLink.Data.Sybase.dll         ; Managed Sybase SQLServer
    ;     or
    csc /r:OpenLink.Data.OdbcClient.dll     ; Unmanaged ODBC based
    

    Referenced by...