Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FluentNhibernate and SQLite

I can't get SQLite Driver working in my sessionfactory.

I downloaded SQLite 1.0.48 from http://sqlite.phxsoftware.com/

I have added the references to System.Data.SQLite in my Tests project.

public static IPersistenceConfigurer GetSqlLiteConfigurer()
        {
            try
            {
                return SQLiteConfiguration
                .Standard
                .InMemory();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

This is how I generate the Configurer

The problem is when I build my sessionfactory I get the following error:

NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor() 

I have tried to change of SQLite version but did not fix the issue.

I can't find what's the problem and I have been working on this for 2 days now.

Let me know if you need more information.

Thanks for the help!

Charles

like image 494
Charles Ouellet Avatar asked May 10 '09 15:05

Charles Ouellet


2 Answers

When I ran into this issue it was caused by running having my application's processor property set to anycpu and running on a 64bit system. To correct the issue I set my application processor property to x86. I don't think the System.Data.SQLite.dll supports running under a x64 process.

like image 146
Aaron Fischer Avatar answered Oct 05 '22 18:10

Aaron Fischer


I have fixed my problem by getting the System.Data.SQLite.dll file that is in the FluentNHibernate SVN Repository.

This is now working very well.

I should have checking this earlier ;)

like image 35
Charles Ouellet Avatar answered Oct 05 '22 20:10

Charles Ouellet