-
Notifications
You must be signed in to change notification settings - Fork 24
Using Firebird
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.
Install the FirebirdSql.Data.FirebirdClient nuget package:
Install-Package FirebirdSql.Data.FirebirdClient
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.
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>
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();
...
}
- 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.