public InMemoryDatabaseTest(Assembly assemblyContainingMapping) { // This Works // if (Configuration == null) // { // Configuration = new Configuration() // .SetProperty(NHibernate.Cfg.Environment.ReleaseConnections, "on_close") // .SetProperty(NHibernate.Cfg.Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName) // .SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName) // .SetProperty(NHibernate.Cfg.Environment.ConnectionString, "data source=:memory:") // .SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName) // .AddAssembly(assemblyContainingMapping); // // SessionFactory = Configuration.BuildSessionFactory(); // } // // session = SessionFactory.OpenSession(); //new SchemaExport(Configuration).Execute(true, false, true, session.Connection, Console.Out); if (Configuration == null) { var cfg = new StoreConfiguration(); Configuration = Fluently.Configure() .Database( SQLiteConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("MyConnectionString")) ) .Mappings(m =>m.AutoMappings.Add(AutoMap.AssemblyOf<User>(cfg))) .BuildConfiguration(); SessionFactory = Configuration.BuildSessionFactory(); } session = SessionFactory.OpenSession(); new SchemaExport(Configuration).Execute(true, false, true, session.Connection, Console.Out); }
public InMemoryDatabaseTest(Assembly assemblyContainingMapping) { // This Works // if (Configuration == null) // { // Configuration = new Configuration() // .SetProperty(NHibernate.Cfg.Environment.ReleaseConnections, "on_close") // .SetProperty(NHibernate.Cfg.Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName) // .SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName) // .SetProperty(NHibernate.Cfg.Environment.ConnectionString, "data source=:memory:") // .SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName) // .AddAssembly(assemblyContainingMapping); // // SessionFactory = Configuration.BuildSessionFactory(); // } // // session = SessionFactory.OpenSession(); //new SchemaExport(Configuration).Execute(true, false, true, session.Connection, Console.Out); if (Configuration == null) { var cfg = new StoreConfiguration(); Configuration = Fluently.Configure() .Database( SQLiteConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("MyConnectionString")) ) .Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf <User>(cfg))) .BuildConfiguration(); SessionFactory = Configuration.BuildSessionFactory(); } session = SessionFactory.OpenSession(); new SchemaExport(Configuration).Execute(true, false, true, session.Connection, Console.Out); }