I tried my first project with Fluent NHibernate (any taste of NHibernate, for that matter). I was unable to go through the step of creating a Session Factory object when I started with the following exception:
InnerException: NHibernate.HibernateException 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. Source=NHibernate StackTrace: at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName) at NHibernate.Driver.SqlServerCeDriver..ctor() InnerException:
I use the latest FluentNHibernate executables. VS 2010, in the window 7 x64. I set the assembly System.Data.SqlServerCe to Copy Local, changing the project target platform to x86.
Free configuration:
var config = Fluently.Configure() .Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(cnxString)) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<SyncContract>()); if (!File.Exists(dbPath)) { var engine = new System.Data.SqlServerCe.SqlCeEngine(cnxString); engine.CreateDatabase(); config.ExposeConfiguration(c => new SchemaExport(c).Create(false, true)); } return config;
Note: engine.CreateDatabase () is working fine.
Any help / ideas please?
nhibernate fluent-nhibernate
Sameera
source share