public void SetUp() { var nhibernateProperties = SQLiteConfiguration.UsingFile(Path.GetTempFileName()); SessionFactory = new SessionFactoryBuilder(typeof(TestSaga).Assembly.GetTypes()) .Build(nhibernateProperties, true); SagaPersister = new SagaPersister { SessionFactory = SessionFactory }; UnitOfWork = new UnitOfWorkManager { SessionFactory = SessionFactory }; }
public void SetUp() { string connectionString = String.Format(@"Data Source={0};Version=3;New=True;", Path.GetTempFileName()); Configure.ConfigurationSource = new FakeConfigurationSource(); NHibernateSettingRetriever.AppSettings = () => new NameValueCollection { { "NServiceBus/Persistence/NHibernate/dialect", dialect } }; NHibernateSettingRetriever.ConnectionStrings = () => new ConnectionStringSettingsCollection { new ConnectionStringSettings("NServiceBus/Persistence/NHibernate/Saga", connectionString) }; ConfigureNHibernate.Init(); Configure.Features.Enable <Features.Sagas>(); var types = typeof(TestSaga).Assembly.GetTypes().ToList(); types.Add(typeof(ContainSagaData)); Configure.With(types) .DefineEndpointName("Foo") .DefaultBuilder() .UseNHibernateSagaPersister(); var builder = new SessionFactoryBuilder(Configure.TypesToScan); var properties = ConfigureNHibernate.SagaPersisterProperties; SessionFactory = builder.Build(ConfigureNHibernate.CreateConfigurationWith(properties)); UnitOfWork = new UnitOfWorkManager { SessionFactory = SessionFactory }; SagaPersister = new SagaPersister { UnitOfWorkManager = (UnitOfWorkManager)UnitOfWork }; new Installer().Install(WindowsIdentity.GetCurrent().Name); }
public void SetUp() { string connectionString = String.Format(@"Data Source={0};Version=3;New=True;", Path.GetTempFileName()); Configure.ConfigurationSource = new FakeConfigurationSource(); NHibernateSettingRetriever.AppSettings = () => new NameValueCollection { {"NServiceBus/Persistence/NHibernate/dialect", dialect} }; NHibernateSettingRetriever.ConnectionStrings = () => new ConnectionStringSettingsCollection { new ConnectionStringSettings("NServiceBus/Persistence/NHibernate/Saga", connectionString) }; ConfigureNHibernate.Init(); Configure.Features.Enable<Features.Sagas>(); var types = typeof(TestSaga).Assembly.GetTypes().ToList(); types.Add(typeof(ContainSagaData)); Configure.With(types) .DefineEndpointName("Foo") .DefaultBuilder() .UseNHibernateSagaPersister(); var builder = new SessionFactoryBuilder(Configure.TypesToScan); var properties = ConfigureNHibernate.SagaPersisterProperties; SessionFactory = builder.Build(ConfigureNHibernate.CreateConfigurationWith(properties)); UnitOfWork = new UnitOfWorkManager { SessionFactory = SessionFactory }; SagaPersister = new SagaPersister { UnitOfWorkManager = (UnitOfWorkManager)UnitOfWork }; new Installer().Install(WindowsIdentity.GetCurrent().Name); }
protected void RegisterUow(IManageUnitsOfWork uow) { FuncBuilder.Register <IManageUnitsOfWork>(() => uow); }