开发者

NHibernate and SQLite exception

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 IDbComm开发者_StackOverflowand 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??


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜