public static void InitializeDataFactory(DataSupoortSettings settings) { _assemblies = settings.MappingAssemblies; Profiling = settings.Profiling; var connection = !settings.InMemory ? settings.ConnectionString : "Data Source=:memory:;Version=3;New=True;Pooling=True;Max Pool Size=1"; var express = settings.Express; var recreateMedia = settings.RecreateMedia; RecreateSchema = settings.RecreateSchema; if (recreateMedia && !settings.InMemory) { var builder = new MsSqlConfigurator(connection, express); builder.DestroyMedia(); builder.CreateMedia(); } NHibernateSupport = new NHSupport(connection, _assemblies, settings.InMemory); //create the schema if (RecreateSchema) NHibernateSupport.CreateSchema(true); else NHibernateSupport.UpdateSchema(); }
protected override void OnConfigure() { var asm = typeof(TestBase).Assembly.FullName; var settings = new DataSupoortSettings { ConnectionString = ConfigurationManager.AppSettings["connection"], Express = Convert.ToBoolean(ConfigurationManager.AppSettings["express"]), InMemory = ConfigurationManager.AppSettings["mode"] == "memory", MappingAssemblies = new List<string> { asm }, Profiling = Convert.ToBoolean(ConfigurationManager.AppSettings["profiling"]), RecreateMedia = Convert.ToBoolean(ConfigurationManager.AppSettings["recreateMedia"]), RecreateSchema = Convert.ToBoolean(ConfigurationManager.AppSettings["recreateSchema"]) }; if (settings.Profiling) NHibernateProfiler.Initialize(); if (!TestHelper.IsUpFor(asm)) TestHelper.InitializeDataFactory(settings); }