views:

1486

answers:

3

Hi,

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

+3  A: 

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 ;)

couellet
Thanks. This solved the issue for me.
statenjason
+6  A: 

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.

Aaron Fischer
System.Data.SQLite.dll *is* available for x64, it's just another assembly (which is included in the x64 directory)
Mauricio Scheffer
+1 this solved the issue for me (even using the x64 dll from SQLite didn't seem to work)
Ben Aston
worked for me too
Kevin
A: 

I am hitting the same problem on a build machine. It works fine when I open the project with Visual Studio, but when I run mstest.exe it fails with the above error. It also fails on my local development machine when I run by command line. Process Monitor shows no attempts to even locate the file by mstest.exe.

The build machine is 32-bit, my local machine is 64-bit. The assembly we are using is the one from the Fluent NHibernate trunk.

UPDATE: Figured it out - mstest.exe wasn't copying all of the assemblies when it was being run from the command line. I updated the localtestrun.config to include them under Deployment. Not sure why the behaviour is different from the IDE and command line test runner.

Colin Bowern