Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL.Data.SqlLite version with NHibernate 2.1

Tags:

nhibernate

What version/implementation of the SQLLite can be used with NHibernate. I get an error:

The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly.

Let me say that dll is in the bin directory, I made sure. I am using System.Data.SQLite.DLL version 1.0.60.0.

Here is the hibernate.cfg.xml

    <property name="connection.driver_class">
        <!--NHibernate.Driver.SqlClientDriver-->
        NHibernate.Driver.SQLiteDriver
    </property>
     <property name="connection.connection_string">
        <!--    Server=.\SQLEXPRESS;User Id=epitka;Password=password;Database=dnn49;-->
        Data Source=nhibernate.db;Version=3
  </property>
  <property name="dialect">NHibernate.Dialect.SQLiteDialect</property>

  <property name="query.substitutions">true=1;false=0</property>

  <property name="show_sql">true</property>

I am running this on Window XP box.

like image 827
epitka Avatar asked Jan 24 '23 04:01

epitka


1 Answers

IDbCommand and IDbConnection are in the System.Data namespace, not in SQLite. Would you post your nhibernate configuration settings?

Here are the relevant settings

dialect = NHibernate.Dialect.SQLiteDialect, NHibernate
connection.driver_class = NHibernate.Driver.SQLite20Driver, NHibernate

SQLite20Driver is for System.Data.SQLite, while SQLiteDriver is for SQLite.NET. So SQLite20Driver is your answer.

like image 124
Canton Avatar answered Feb 01 '23 09:02

Canton