I have problem with this exception:
Hibernate.HibernateException : Could not create the driver from Hibernate.Driver.SqlServerCeDriver.
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> NHibernate.HibernateException : The IDbCommand and IDbConnection implementation in the ssembly System.Data.SqlServerCe could not be found. Ensure that the assembly System.Data.SqlServerCe 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.
I tried everything. I googled a lot.
System.Data.SqlServerCe.dll is in debug directory. Is local referenced, is not i GAC. I have copy local set true. In debug directory is all other needed sql*.dll. I tried x86 compilation but nothig.
This is my nhibernate config:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Spring.ProxyFactoryFactory, NHibernate.ByteCode.Spring</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSqlCeDialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</property>
<property name="show_sql">true</property>
<!-- mapping files -->
</session-factory>
</hibernate-configuration>
NHibernate version 3.0 beta 1, SqlServerCe version 3.5 SP1
My idea: Nhibernate still look in GAC, becouse a had installed SqlServerCe, after uninstall the problem starts. How can I say to NHibernate: "please look take this dll?":)
You (or the NHibernate dll) are referencing a different version of the System.Data.SqlServerCe dll in the project than what it is expecting. For instance, NHibernate may be referencing the .NET 3.5 version of the dll, but you have the .NET 4.0 version of the dll in the GAC or local bin directory. You can instruct the .NET framework to use a specific AssemblyBinding to correct the problem. Type the following in your config file to fix it.
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1"><qualifyAssembly
partialName="System.Data.SqlServerCe" fullName="System.Data.SqlServerCe,
Version=3.5.1.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91"/>
</assemblyBinding>
</runtime>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With