This question is locked. New answers and comments are not allowed.

Tsybulnikov
Top achievements
Rank 1
Tsybulnikov
asked on 07 Aug 2014, 04:52 PM
Can I use Data Access ORM with Firebird without necessary to install Firebird Provider .Net?
Where I should specify FirebirdSql.Data.FirebirdClient.dll ?
Where I should specify FirebirdSql.Data.FirebirdClient.dll ?
4 Answers, 1 is accepted
0

Tsybulnikov
Top achievements
Rank 1
answered on 07 Aug 2014, 05:18 PM
_connectionString = @
"character set=WIN1251;initial catalog=D:\TestApp\bin\x86\Release\POST.FDB;clientlibrary=D:\TestApp\Binaries\fbembed.dll;password=masterkey;user id=SYSDBA;data source=AbonDb;server type=1"
;
var dataContext =
new
AbonDataEntitiesModel(_connectionString);
var s = dataContext.Employees.FirstOrDefault();
I use Firebird Embbded Server and specified it in connection string like above. But if I don't install FirebirdProvider I will take next exception:
System.IO.FileLoadException: Cannot load file or assembly "FirebirdSql.Data.FirebirdClient, Version=4.2.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" (Exception HRESULT: 0x80131040)
0
Accepted
Hello Oleg,
as far as I know using the embedded Firebird database should be possible, but you will need to make the Firebird driver assemblies known and available. You should be able to do so by adding a
<system.data>
<DbProviderFactories>
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=3.0.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
</DbProviderFactories>
</system.data>
configuration file entry to you app.config. This tells the .NET runtime what to use when looking for a ADO driver for firebird. To use the embedded version, you will need to specify that via the ServerType=1 in the connection string (see https://www.connectionstrings.com/firebird/ )
Don't forget to put the FirebirdSql.Data.FirebirdClient assembly into you assembly folder!
Regards,
Thomas
Telerik
as far as I know using the embedded Firebird database should be possible, but you will need to make the Firebird driver assemblies known and available. You should be able to do so by adding a
<system.data>
<DbProviderFactories>
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=3.0.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
</DbProviderFactories>
</system.data>
configuration file entry to you app.config. This tells the .NET runtime what to use when looking for a ADO driver for firebird. To use the embedded version, you will need to specify that via the ServerType=1 in the connection string (see https://www.connectionstrings.com/firebird/ )
Don't forget to put the FirebirdSql.Data.FirebirdClient assembly into you assembly folder!
Regards,
Thomas
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Tsybulnikov
Top achievements
Rank 1
answered on 08 Aug 2014, 08:44 AM
Yes. It's approach work for application (exe), but it doesn't work with assembly. I found next trick to do this:
var assembly = Assembly.GetAssembly(
typeof
(FirebirdClientFactory));
var assemblyName = assembly.GetName();
var dataSet = ConfigurationManager.GetSection(
"system.data"
)
as
System.Data.DataSet;
var table = dataSet.Tables[0];
foreach
(DataRow row
in
table.Rows.Cast<DataRow>().ToList())
{
if
(row[2].ToString() == assembly.GetName().Name)
{
table.Rows.Remove(row);
}
}
table.Rows.Add(
"FirebirdSql Data Provider"
,
".Net Framework Data Provider for FirebirdSql"
, assembly.GetName().Name
//"FirebirdSql.Data.FirebirdClient"
,
string
.Format(@
"FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, {0}"
,
assembly.FullName
)
);
0
Hi Oleg,
thanks for sharing this code with us. This is the programmatic way of modifying the runtime configuration to know about a certain ADO database driver.
Regards,
Thomas
Telerik
thanks for sharing this code with us. This is the programmatic way of modifying the runtime configuration to know about a certain ADO database driver.
Regards,
Thomas
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.