private ISessionFactory BuildFactory() { Configuration cfg = new ConfigurationFactory().Build(); ISessionFactory sessionFactory = cfg.BuildSessionFactory(); return(sessionFactory); }
public void RecreateDatabase() { var configuration = new ConfigurationFactory().CreateConfiguration(); var schemaExport = new SchemaExport(configuration); // The current dir is the bin/Debug folder so we back out of there. schemaExport.SetOutputFile(@"..\..\..\database\create_schema.sql"); schemaExport.Execute(true, true, false); // We expect two generator tables - the default one used by most of the model classes, // and the one with all params specified that uses a custom table and column. var sessionFactory = configuration.BuildSessionFactory(); // Check default generator table VerifyGeneratorTable(sessionFactory, "hibernate_unique_key", "next_id", 1); // Check params generator table VerifyGeneratorTable(sessionFactory, "HibernateUniqueKey", "NextId", 1); }
private static ISessionFactory BuildFactory() { Configuration cfg = new ConfigurationFactory().Build(); ISessionFactory sessionFactory = cfg.BuildSessionFactory(); return sessionFactory; }