Isaac Bolinger
Isaac Bolinger

Reputation: 7388

How can I reference the mysql connector in nhibernate without installing the mysql connector msi?

I need some help with the configuration file. I have included MySql.Data.dll in my project, but how can I tell the configuration file that this dll contains the MySQL connector?

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="NHibernate.Test">
<property name="connection.provider">
  NHibernate.Connection.DriverConnectionProvider
</property>
<property name="connection.driver_class">
  MySql.Data <!--this attempt didn't work!! -->
</property>
<!--<property name="hbm2ddl.auto">update</property> -->
<property name="connection.connection_string">
  Server=f.xx.ca;Database=xx;Uid=root;Pwd=xx;
</property>

<property name="adonet.batch_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.MySQL5Dialect</property>
<!-- <property name="use_outer_join">true</property> -->
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>

<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
<property name="cache.use_second_level_cache">false</property>

I'm getting fed up with installing the connector with the msi every time I try to debug the project on a new computer.

Thanks!

Upvotes: 0

Views: 333

Answers (1)

Rippo
Rippo

Reputation: 22424

If the MySql.Data.dll is a reference inside your Visual Studio Solution and is set to Copy local = true then you don't need to install the msi, e.g.

enter image description here

The connection drive class should then:-

<property name="connection.driver_class">
    NHibernate.Driver.MySqlDataDriver
</property>

Upvotes: 1

Related Questions