protected DatabaseFixture() { BeforeSetup(); SillyContainer.SessionProvider = (() => session); var sillyContainer = new SillyContainer(); ServiceLocator.SetLocatorProvider(() => sillyContainer); var cfg = new Configuration() .SetProperty(Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName) .SetProperty(Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName) .SetProperty(Environment.ConnectionString, ConnectionString) .SetProperty(Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName) .SetProperty(Environment.ReleaseConnections, "on_close") .SetProperty(Environment.UseSecondLevelCache, "true") .SetProperty(Environment.UseQueryCache, "true") .SetProperty(Environment.CacheProvider,typeof(HashtableCacheProvider).AssemblyQualifiedName) .AddAssembly(typeof (User).Assembly); Security.Configure<User>(cfg, SecurityTableStructure.Prefix); factory = cfg.BuildSessionFactory(); session = factory.OpenSession(); new SchemaExport(cfg).Execute(false, true, false, session.Connection, null); session.BeginTransaction(); SetupEntities(); }
protected DatabaseFixture() { BeforeSetup(); Monitor.Enter(sync); SillyContainer.SessionProvider = (() => session); var sillyContainer = new SillyContainer(); ServiceLocator.SetLocatorProvider(() => sillyContainer); Assert.NotNull(typeof(SQLiteConnection)); Configuration cfg = new Configuration() .SetProperty(Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName) .SetProperty(Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName) //.SetProperty(Environment.ConnectionDriver, typeof(Sql2008ClientDriver).AssemblyQualifiedName) //.SetProperty(Environment.Dialect, typeof(MsSql2008Dialect).AssemblyQualifiedName) .SetProperty(Environment.ConnectionString, ConnectionString) //.SetProperty(Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName) .SetProperty(Environment.ReleaseConnections, "on_close") .SetProperty(Environment.UseSecondLevelCache, "true") .SetProperty(Environment.UseQueryCache, "true") .SetProperty(Environment.CacheProvider, typeof(HashtableCacheProvider).AssemblyQualifiedName) .SetProperty(Environment.ShowSql, "true") .AddAssembly(typeof(User).Assembly); Security.Configure <User>(cfg, SecurityTableStructure.Prefix); factory = cfg.BuildSessionFactory(); session = factory.OpenSession(); new SchemaExport(cfg).Execute(true, true, false, session.Connection, null); session.BeginTransaction(); SetupEntities(); session.Flush(); }