Actually, this might be an NH issue. Looking up the documentation for
Assembly.Load(string), I see "Loads an assembly given the long form of its
name. " Sure enough, when I replace my test case
(Assembly.Load("System.Data.SqlServerCe");) with the long version of the
assembly name (Assembly.Load("System.Data.SqlServerCe, Version=3.5.1.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91");) it works fine. But the
NH call that throws the error uses the first call. Is this a bug in
NHibernate, or is my system just missing a config step that allows it to
resolve "System.Data.SqlServerCe" to the appropriate assembly?
~Dathan
On Mon, Jun 1, 2009 at 3:25 AM, Artur <[email protected]> wrote:
>
> Hi
>
> Are you sure you want to rely on the necessary assemblies being in the
> GAC?
> I think, this way you lose some control over your application and
> expose yourself to various problems, e.g. versioning.
>
> Sql Server Ce can be privately deployed with the application. You can
> find many materials on this on the web.
> A good source of information on SqlServerCe is Steve Lasker's blog,
> for example you can find info on private deployment in this blog post:
>
> http://blogs.msdn.com/stevelasker/archive/2008/10/22/privately-deploying-sql-server-compact-with-the-ado-net-entity-provider.aspx
>
> Artur Dorochowicz
>
>
> On 1 Cze, 05:26, Dathan Bennett <[email protected]> wrote:
> > 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
-~----------~----~----~----~------~----~------~--~---