3
votes

When i try to deploy mapped table into database with GenerateSchema..i get the exception:

NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLiteDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: 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..

I tried to solve this with NHibernate.Driver.SQLiteDriver -> NHibernate.Driver.SQLite20Driver..but did not worked..I added all references for NHibernate, Sqlite..Linfu...

Has anyone idea for solution??

1
if more details are needed ill post it..shake

1 Answers

5
votes

A stab in the dark:

The one thing that always catches me out with SQLite is that it's a mixed assembly; it contains both managed and native code and targets one configuration (typically x86). If you're working on a 64 bit operating system and using the x86 version, then you may be having problems with bitness. Unfortunately, this doesn't produce a useful error message.

Try setting your project to build using x86 and see if that helps. Also, make sure you've got the correct version of SQLite. Some versions ('managed only') don't work out of the box. I use this version (unzip and then use the "System.Data.SQLite.DLL" file from the root directory).

I've run into these problems in the past and it took a bit of trial and error to get it working.