FluentNHibernate with .NET4

stiank81's Avatar

stiank81

23 Apr, 2010 11:49 AM via web

Is FluentNHibernate supported with .NET4? I am upgrading my project to .NET4, but after doing so I run into problems on runtime.. When calling FluentConfiguration.BuildConfiguration() I get an exception which seem to be related to the version of my SQLite dll. I suspect this to be related to some mismatch between x86 and x64 assemblies, but if so I don't understand why changing my project to .NET4 should give this problem. Everything worked fine before.

The inner exception is:
Message = "Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4."

For all details, relevant links, etc please visit the question I asked on StackOverflow:
http://stackoverflow.com/questions/2697795/using-fluentnhibernate-w...

So; should I expect it to work? Or what steps are necessary to make it work? Thanks for any feedback!

  1. 2 Posted by Daniel15 on 25 Apr, 2010 10:42 AM

    Daniel15's Avatar

    Try checking the InnerException of that exception, as often it'll have more useful information. I was getting the same error, and it was just because the System.Data.Sqlite.dll file wasn't in my GAC or application's bin directory.

  2. 3 Posted by stiank81 on 27 Apr, 2010 10:47 AM

    stiank81's Avatar

    Yeah - I see there is an InnerException of that exception again - saying:

    "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."

    The dll probably isn't in my GAC, but it sure is in the application bin directory. Everywhere I reference it I have "Copy Local"=True, and I have verified that it is wherever I need it. I have also manually copied it to every bin/Debug folder in the solution. Still says it can't find it.

    Any idea what might be causing this? And why would I get a problem with this just from moving to .Net4?

    Thx!

  3. 4 Posted by Berryl on 05 May, 2010 12:36 AM

    Berryl's Avatar

    I have had a thread on SO about this since 2010 was launched, and it is a royal PITA.

    Make sure you've got the latest sqlite dll (there was a release right after 2010 was launched that was foobar), adjust your config for mixed loading, and after all that, dump the dll inside bin. At least that's what I've been doing for the past two weeks.

    It's not an FNH thing though. Please post any better solutions you come up with on SO too.

    B

  4. 5 Posted by stiank81 on 05 May, 2010 06:48 AM

    stiank81's Avatar

    You're right - it's not a FluentNhibernate issue. Seems like it is a SQLite issue. The System.Data.SQLite dll doesn't support .Net4 yet, and to make it work you need to add this to your App.config file:

    <?xml version="1.0" encoding="utf-8" ?>


    (source: http://sqlite.phxsoftware.com/forums/t/2322.aspx)

  5. 6 Posted by stiank81 on 05 May, 2010 07:04 AM

    stiank81's Avatar

    Ok - for some reason most of the XML in the comment above isn't shown in the post, but you'll find it at det source location..

  6. James Gregory closed this discussion on 16 May, 2010 05:25 PM.

Comments are currently closed for this discussion. You can start a new one.