Created
July 23, 2009 11:25
-
-
Save colinramsay/152768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sqlite Test Base for Fluent NH - needs AddDefaultMappings extension method to NH.Cfg.Configuration | |
using System; | |
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using Luxington.EstimateAggregator.Core.NHibernate; | |
using NHibernate; | |
using NHibernate.Cfg; | |
using NHibernate.Tool.hbm2ddl; | |
namespace Luxington.EstimateAggregator.UnitTests.NH | |
{ | |
public class InMemoryFluentNHTestBase : IDisposable | |
{ | |
private static Configuration _configuration; | |
private static ISessionFactory _sessionFactory; | |
protected ISession _session; | |
public InMemoryFluentNHTestBase() | |
{ | |
if (_configuration == null) | |
{ | |
_configuration = | |
Fluently.Configure().Database(SQLiteConfiguration.Standard.InMemory()).BuildConfiguration().AddDefaultMappings(); | |
} | |
_sessionFactory = _configuration.BuildSessionFactory(); | |
_session = _sessionFactory.OpenSession(); | |
new SchemaExport(_configuration).Execute(true, true, false, _session.Connection, Console.Out); | |
} | |
public void Dispose() | |
{ | |
_session.Dispose(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment