I've narrowed it down to the ConnectionDriver.ConfigureDriver method. The
call to ReflectorHelper.ClassForName returns what looks like the right
class, but then Activator.CreateInstance throws a TargetInvocationException
with the InnerException being one of NHibernate.HibernateException with
message "The IDbCommand and IDbConnection implementation in the assembly
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."
The innermost exception was thrown by ReflectHelper.TypeFromAssembly at a
call to Assembly.Load("System.Data.SqlServerCe"): FileNotFoundException...
I dunno why it would fail to find the assembly, though. It's not a
framework version mismatch, and I'm pretty sure the SqlServerCe assembly is
in the GAC... I stuck an identical line (Assembly assy =
Assembly.Load("System.Data.SqlServerCe");) into the test program, and it
failed there, too. This is clearly not an NHibernate problem -- is this a
system configuration issue? Has anyone encountered it before?
~Dathan
On Sun, May 31, 2009 at 9:14 PM, Dathan <[email protected]> wrote:
>
> I'm trying to port a project I've previously had running against a SQL
> Server 2005 database to use SQL Server CE instead. I'm trying to use
> the following code:
>
> configuration = new Configuration();
>
> configuration.SetProperty
> (NHibernate.Cfg.Environment.ConnectionDriver,
> "NHibernate.Driver.SqlServerCeDriver");
> configuration.SetProperty
> (NHibernate.Cfg.Environment.Dialect,
> "NHibernate.Dialect.MsSqlCeDialect");
> configuration.SetProperty
> (NHibernate.Cfg.Environment.ConnectionProvider,
> "NHibernate.Connection.DriverConnectionProvider");
> configuration.SetProperty
> (NHibernate.Cfg.Environment.ConnectionString, String.Format
> ("DataSource={0}", filename));
> configuration.SetProperty
> (NHibernate.Cfg.Environment.ShowSql, "true");
> configuration.SetProperty
> (NHibernate.Cfg.Environment.ReleaseConnections, "on_close");
>
> // now the mappings
> configuration.AddXmlFile("Mappings\\Player.hbm.xml");
>
> factory = configuration.BuildSessionFactory();
>
> I'm receiving the following error at the final line:
> An unhandled exception of type 'NHibernate.HibernateException'
> occurred in NHibernate.dll
>
> Additional information: Could not create the driver from
> NHibernate.Driver.SqlServerCeDriver.
>
> Can anyone point me out where I'm going wrong?
>
> Thanks!
>
> ~Dathan
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---