Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create the driver from NHibernate.Driver.SQLite20Driver

Here's the code that raises the exception

   public Configuration GetConfiguration()
    {
        var persister = SQLiteConfiguration
            .Standard
            .UsingFile("Test.db")
            .ShowSql();


        var configuration = Fluently
            .Configure()
            .Database(persister)
            .Mappings(map => map.FluentMappings.AddFromAssemblyOf<WordMap>())
            .BuildConfiguration();

        new SchemaExport(configuration).Execute(true, true, false);

        return configuration;

    }

The full exception text:

Failure: NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.

----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.

----> 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 element in the application configuration file to specify the full name of the assembly.

Version of NHibernate is 2.1.2.4000
Version of System.Data.SQLite is 1.0.66.0
Target Framework is 3.5 (x86)
Local copy for System.Data.SQLite is ON.

What may be wrong?

like image 288
StuffHappens Avatar asked Nov 18 '10 12:11

StuffHappens


2 Answers

Just copy System.Data.SQLite.dll library to the the base directory of your application (especially where NHibernate.dll library is placed). You even don't need it to add as reference under VS.

Regards
Bronek

like image 143
Bronek Avatar answered Sep 21 '22 14:09

Bronek


I just installed the SQLite NuGet package and that worked for me.

like image 39
MoMo Avatar answered Sep 23 '22 14:09

MoMo