Hay. I'm try to use NHibernate in VS 2005. I have succsesfull connection on SQL Express 2005 DB. Then I try connect to CE Mobile (SQL 3.0 Mobile) database and NHibernate show me error - Could not create the driver from NHibernate.Driver.SqlServerCeDriver
My files and code list below:
Error
Code:
NHibernate.HibernateException was unhandled
Message="Could not create the driver from NHibernate.Driver.SqlServerCeDriver."
Source="NHibernate"
StackTrace:
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary settings)
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary settings)
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
hibernate.cfg.xmlCode:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<!-- an ISessionFactory instance -->
<session-factory>
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</property>
<property name="connection.connection_string">Data Source ='C:\Temp\SimpleDB.sdf'; Password='simple'</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSqlCeDialect</property>
<property name="use_outer_join">true</property>
<!-- mapping files -->
<mapping assembly="MyNHib" />
</session-factory>
</hibernate-configuration>
User.hbm.xmlCode:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyNHib" namespace="MyNHib">
<class name="MyNHib.User" table="users">
<id name="Id" column="LogonId" type="String" length="20">
<generator class="assigned" />
</id>
<property name="UserName" column="Name" type="String" length="40" />
<property name="Password" type="String" length="20" />
<property name="EmailAddress" type="String" length="40" />
<property name="LastLogon" type="DateTime" />
</class>
</hibernate-mapping>
Program.csCode:
....
ISessionFactory session =
new Configuration().Configure().BuildSessionFactory();
ISession sess = session.OpenSession();
User usr = new User();
usr.Id = "1";
usr.UserName = "Name";
usr.Password = "Pssw";
usr.EmailAddress = "e@mail";
usr.LastLogon = DateTime.Now;
sess.Save(usr);
sess.Flush();
sess.Close();
...
How connect on SQL CE Mobile?
P.S. sorry my poor English.