Пример #1
0
 public void Setup() {
     var databaseConfiguration = new DatabaseConfiguration {
         ServerName = "(local)",
         DatabaseName = "tests",
         CreateDatabase = true
     };
     var autoMap = Map.Create();
     var sessionFactory = SessionFactoryFactory.Create(autoMap, databaseConfiguration);
     session = sessionFactory.OpenSession();
 }
Пример #2
0
 public static ISessionFactory Create(FluentConfiguration fluentConfiguration, DatabaseConfiguration databaseConfiguration) {
     var sessionFactory = fluentConfiguration
         .Database(MsSqlConfiguration.MsSql2005
             .ConnectionString(c => c
                 .Database(databaseConfiguration.DatabaseName)
                 .Server(databaseConfiguration.ServerName)
                 .TrustedConnection())
             .ShowSql())
         .ExposeConfiguration(configuration => {
             if (databaseConfiguration.CreateDatabase) {
                 new SchemaExport(configuration).Create(true, true);
             }
         })
         .BuildSessionFactory();
     return sessionFactory;
 }
Пример #3
0
 public void ProcessConfiguration(DatabaseConfiguration databaseConfiguration) {
     sessionFactory = SessionFactoryFactory.Create(Map.Create(), databaseConfiguration);
 }