luan-nvg / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

NHibernate 3.0 support -please re-target project #77

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have written a driver for NHibernate and this has been accepted so there will 
be support for c#sqlite out of the box in the next version (3.0.0).
There is one hurdle at the moment that users will have to manually correct and 
this is to remove all x86 targets (use Any CPU only) for the 
Community.CsharpSqlite and Community.CsharpSqlite.SQLiteClient projects and 
then recompile them.

If this is not done, then the reflection that NHibernate performs to identify 
the IDbCommand implementors fails with a BadImageException. 
This is because of x86 is targeted. What's even worse, NHibernate swallows this 
exception and replaces it with a generic "please check the library exists" type 
of thing, making it quite difficult to get to the bottom of this problem.

So please re-target to "Any CPU" (in Project Settings) all x86 targets so that 
people can download and drop the two libraries and start using NHibernate 
straight away instead of chasing down type instantiation exceptions. I think 
retaining these targets adds no value to this project, but removing them 
enables quick-starting NHibernate/C#Sqlite projects.

Original issue reported on code.google.com by nicholas...@gmail.com on 13 Aug 2010 at 1:46

GoogleCodeExporter commented 8 years ago
I will be releasing 3.7 soon, and will make sure that the projects are all set 
to "Any CPU" at that time.  

ALso, I'm going to repost on the discussion group first to get other inputs.

Original comment by noah.hart@gmail.com on 13 Aug 2010 at 3:31

GoogleCodeExporter commented 8 years ago
I am seeing the following error message when trying to use NHibernate and 
CsharpSqlite:  +        base    {"The IDbCommand and IDbConnection implementation in the 
assembly Community.CsharpSqlite.SQLiteClient could not be found. Ensure that 
the assembly Community.CsharpSqlite.SQLiteClient 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."}    System.ApplicationException 
{NHibernate.HibernateException}

I did not receive this error message when running my application on an x86 
system but am getting it now on x64.  I've tried running my application as a 
x86 and x64 process but neither have worked.  All of the DLL's I am referencing 
are built with "Any CPU"

Any help would be greatly appreciated

Original comment by jorm...@gmail.com on 13 Jan 2011 at 4:48

GoogleCodeExporter commented 8 years ago
Hi jormenz, I have asked Noah if he could target "Any CPU" on all projects and 
this is the problem you're probably facing. You must re-compile the 
CSharpSQLite DLLs and ensure that for all projects the target is "Any CPU". The 
reason you were not getting any problems on x86 systems is that some of the 
projects are specifically targeting that architecture. Please recheck all 
projects.

Original comment by nicholas...@gmail.com on 13 Jan 2011 at 4:56

GoogleCodeExporter commented 8 years ago
Hi,  I already did this.  Any other ideas?

Original comment by jorm...@gmail.com on 13 Jan 2011 at 5:03

GoogleCodeExporter commented 8 years ago
If you're using NHibernate 2.1.2 you can use my Release (I have made a 
modification in the NH class loading because when a reflection error occurs 
during driver instantiation, the root exception is swallowed and a generic 
message like the one you get is instead used; this makes it hard to detect the 
actual problem). Otherwise you will have to make the change yourself in NH 
source and observe the actual exception message to identify the problem. I 
would insist that it has to do with a BadImageFormatException due to x86, but 
this should help if I'm wrong. Download link: 
http://www.mediafire.com/?rs7j8x71t9wsu1m (temporary)

Original comment by nicholas...@gmail.com on 13 Jan 2011 at 5:13

GoogleCodeExporter commented 8 years ago
Thanks.  I think I must have had a cache issue.  I delete all of my bin/obj 
folders and now I'm all set.  Appreciate your time.

Original comment by jorm...@gmail.com on 13 Jan 2011 at 5:20

GoogleCodeExporter commented 8 years ago
I'm right in the middle of finishing the 3.7.5 changes;  I'll make sure to 
change the target when I check it all in.

Thanks for all your comments

Original comment by noah.hart@gmail.com on 14 Jan 2011 at 5:49

GoogleCodeExporter commented 8 years ago
Fixed in 3.7.5 checkin

Original comment by noah.hart@gmail.com on 6 Mar 2011 at 11:44