Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Using Firebird

TrevorPilley edited this page Sep 18, 2014 · 4 revisions

Version Support

MicroLite is built to work with any version of Firebird from 2.5 onwards but requires FirebirdSql.Data.FirebirdClient to be installed as the .NET framework does not ship a native provider for Firebird.

Installing the Provider

Install the FirebirdSql.Data.FirebirdClient nuget package:

Install-Package FirebirdSql.Data.FirebirdClient

Register the Provider

Add the section to your app.config/web.config so that the .NET framework knows about the FirebirdSql.Data.FirebirdClient provider:

<system.data>
    <DbProviderFactories>
      <remove invariant="FirebirdSql.Data.FirebirdClient" />
      <add name="Firebird Data Provider"
           invariant="FirebirdSql.Data.FirebirdClient"
           description="ADO.Net driver for Firebird"
           type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient,
                 Version=4.1.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
    </DbProviderFactories>
</system.data>

Make sure that the version specified matches the version you have installed or you will get an exception thrown by the .NET runtime at startup when it tries to resolve the assembly.

Connection String

Add a named connection string for your Database specifying the provider name.

<connectionStrings>

    <add name="FirebirdTest"
         connectionString="User=SYSDBA;Password=masterkey;Database=SampleDatabase.fdb;DataSource=localhost;
Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;
MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;"
         providerName="FirebirdSql.Data.FirebirdClient" />

</connectionStrings>

Configuring the Connection

Create a session factory using the ForFirebirdConnection extension method supplying the name of the connection string you added to the app.config/web.config.

using MicroLite;
using MicroLite.Configuration;

static void Main(string[] args)
{
    var sessionFactory = Configure
        .Fluently()
        .ForFirebirdConnection("FirebirdTest")
        .CreateSessionFactory();

    ...
}

Supported Identifier Strategies

MicroLite supports the following Identifier Strategies for SqlServerCe:

  • Assigned
  • DbGenerated (when using an ON INSERT trigger to set the primary key)
  • Sequence (when not using an ON INSERT trigger to set the primary key)

Additional Notes

  • Firebird seems to uppercase table and column names when using flame robin (unless I’m doing something wrong) which means they need to be mapped as upper case and cased in upper in any SQL generated by MicroLite or by custom SqlBuilder queries.

See the Getting Started guide for further details on using MicroLite.

Clone this wiki locally