Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

C# on Windows

This section explains the different settings that are available on the Project Properties page in Microsoft Visual Studio 2013 or 2015. For a full listing of all compiler options, see the Microsoft MSDN documentation.

Most people use the C# SDK to build an ADO.NET provider, but you can also use the C# SDK to write your DSII and build the project as an ODBC driver. The driver can be built to support either local or remote connections, with or without the SQL Engine.

You can use the sample projects from the 5 Day Guides as an example of how to build your own custom driver. For a step-by-step example on how to build the sample projects, see the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/.

Most of the settings described in the section C++ on Windows also apply to C#, but building C# uses a different project for the .Net DSII code.

DotNetDSI and DSII

When writing a C# DSII, you must create a new Visual Studio project for a managed C# class library that does not include any of the settings described for a C++ DSII. Add the following to the project:

  • If the DSII uses the Simba SQLEngine, add the Simba.DotNetDSI and Simba.DotNetDSIExt assemblies.
  • If the DSII does not use the Simba SQLEngine, add the Simba.DotNetDSI assembly.

The base classes from which you derive to code your DSII are all defined in these assemblies. These assemblies can be used for both 32-bit and 64-bit driver development.

Note:

If you are using the CLIDSI, you must match the bitness of your compiled C# DLL to the bitness of the CLIDSI library that is being used.

When using your provider, server, or ODBC driver, you must register this assembly in the Global Assembly Cache (GAC) of Windows.

Simba.NET

In order to build a pure C# ADO.NET provider, you only need your DotNet DSII project and the Simba.DotNetDSI and Simba.ADO.NET assemblies.

Note:

When building a pure C# ADO.NET provider, you cannot use the Simba SQLEngine. To support this deployment scenario, use SimbaServer and the ODBC client.

When using Simba.NET to create an ADO.NET provider, you must extend the following additional abstract classes.

  • SCommand
  • SCommandBuilder
  • SConnection
  • SConnectionStringBuilder
  • SDataAdapter
  • SFactory
  • SParameter

These are part of the Simba.ADO.NET assembly, not the normal DotNet DSI.

You must extend the SConnectionStringBuilder subclass and add any additional properties that are needed to establish a connection to your provider. For example, see the Simba DotNetUltralight sample described in the 5 Day Guides at http://www.simba.com/resources/sdk/documentation/.

The rest of the classes that you extend do not typically need to be modified.

When using your provider, the Simba.DotNetDSI and Simba.ADO.NET assemblies should be registered in the Global Assembly Cache (GAC) of Windows.

Build as an ODBC Driver (a DLL) for local connections

This section explains how to build an ODBC driver for local connections, with or without the Simba SQLEngine. In addition to the DotNet DSII project, you must create a CLIDSI project that provides the bridge between the native C++ Simba ODBC libraries and your CustomerDotNetDSII.dll assembly:

  1. Follow the instructions in Build with the SQL Engine , including all the specified libraries.
  2. Include the library CLIDSI_$(ConfigurationName).lib.
  3. This library forms the bridge between the unmanaged and managed DSI classes.

  4. Enable Common Language Runtime Support (/clr) by selecting the following option:
  5. Configuration Properties -> General -> Common Language Runtime Support

  6. Implement the factory function that constructs your IDriver object:

    Simba::DotNetDSI::IDriver^ Simba::CLIDSI::LoadDriver()

    {

    return gcnew CustomerDotNetDSII::CustomerDSIIDriver();

    }

The output of this project is your custom driver DLL, for example CustomerCLIDSIDriver.dll. This is the actual ODBC driver which will load your CustomerDotNetDSII.dll assembly.

Build as a SimbaServer (an EXE) for Remote Connections

This section explains how to build an ODBC driver for remote connections, with or without the Simba SQLEngine.

In addition to the DotNet DSII project, you must create a CLIDSI project that provides the bridge between the native C++ Simba ODBC libraries and your CustomerDotNetDSII.dll assembly:

  1. Follow the instructions in Build with the SQL Engine, including all the specified libraries.
  2. Include the library CLIDSI_$(ConfigurationName).lib.
  3. This library forms the bridge between the unmanaged and managed DSI classes.

  4. Enable Common Language Runtime Support (/clr) by selecting the following option:
  5. Configuration Properties -> General -> Common Language Runtime Support

  6. Implement the factory function that constructs your IDriver object:

    Simba::DotNetDSI::IDriver^ Simba::CLIDSI::LoadDriver()

    {

    return gcnew CustomerDotNetDSII::CustomerDSIIDriver();

    }

The output of this project is your custom driver DLL, for example CustomerCLIDSIDriver.dll. This is the actual ODBC driver which will load your CustomerDotNetDSII.dll assembly.