Example #1
0
        public void SetUp()
        {
            var builder = new NHibernateSagaStorage();

            var cfg = new Configuration()
                      .DataBaseIntegration(x =>
            {
                x.Dialect <MsSql2012Dialect>();
                x.ConnectionString = Consts.SqlConnectionString;
            });

            var types = new[] { typeof(SagaWithAbstractBaseClassActualSaga), typeof(SagaWithAbstractBaseClass), typeof(ContainSagaData), typeof(MyOwnAbstractBase) };

            var allMetadata = new SagaMetadataCollection();

            allMetadata.Initialize(types);

            var settings = new SettingsHolder();

            settings.Set("TypesToScan", types);
            settings.Set <SagaMetadataCollection>(allMetadata);

            builder.ApplyMappings(settings, cfg);
            sessionFactory = cfg.BuildSessionFactory() as SessionFactoryImpl;
        }
        public void SetUp()
        {
            var builder    = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings      = new SettingsHolder();

            var metaModel = new SagaMetadataCollection();
            var types     = new [] { typeof(TestSaga), typeof(TestSagaData), typeof(TestComponent), typeof(PolymorphicPropertyBase),
                                     typeof(AlsoDerivedFromTestSagaWithTableNameAttributeActualSaga), typeof(AlsoDerivedFromTestSagaWithTableNameAttribute),
                                     typeof(DerivedFromTestSagaWithTableNameAttributeActualSaga), typeof(DerivedFromTestSagaWithTableNameAttribute),
                                     typeof(TestSagaWithTableNameAttributeActualSaga), typeof(TestSagaWithTableNameAttribute),
                                     typeof(SagaWithVersionedPropertyAttributeActualSaga), typeof(SagaWithVersionedPropertyAttribute),
                                     typeof(SagaWithoutVersionedPropertyAttributeActualSaga), typeof(SagaWithoutVersionedPropertyAttribute),
                                     typeof(object) };

            metaModel.Initialize(types);
            settings.Set <SagaMetadataCollection>(metaModel);

            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, configuration);
            sessionFactory = configuration.BuildSessionFactory() as SessionFactoryImpl;

            persisterForTestSaga = sessionFactory.GetEntityPersisterFor <TestSagaData>();
        }
        public void SetUp()
        {
            var builder = new NHibernateSagaStorage();

            var cfg = new Configuration()
                      .DataBaseIntegration(x =>
            {
                x.Dialect <MsSql2012Dialect>();
                x.ConnectionString = Consts.SqlConnectionString;
            });

            var settings = new SettingsHolder();

            var metaModel = new SagaMetadataCollection();
            var types     = new [] { typeof(TestSaga), typeof(TestSagaData), typeof(TestComponent), typeof(PolymorphicPropertyBase),
                                     typeof(AlsoDerivedFromTestSagaWithTableNameAttributeActualSaga), typeof(AlsoDerivedFromTestSagaWithTableNameAttribute),
                                     typeof(DerivedFromTestSagaWithTableNameAttributeActualSaga), typeof(DerivedFromTestSagaWithTableNameAttribute),
                                     typeof(TestSagaWithTableNameAttributeActualSaga), typeof(TestSagaWithTableNameAttribute),
                                     typeof(SagaWithVersionedPropertyAttributeActualSaga), typeof(SagaWithVersionedPropertyAttribute),
                                     typeof(SagaWithoutVersionedPropertyAttributeActualSaga), typeof(SagaWithoutVersionedPropertyAttribute),
                                     typeof(object) };

            metaModel.Initialize(types);
            settings.Set <SagaMetadataCollection>(metaModel);

            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, cfg);
            sessionFactory = cfg.BuildSessionFactory() as SessionFactoryImpl;

            persisterForTestSaga = sessionFactory.GetEntityPersisterFor <TestSagaData>();
        }
        public void SetUp()
        {
            var builder = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings = new SettingsHolder();
            settings.Set("TypesToScan", new[] { typeof(SagaWithAbstractBaseClass), typeof(ContainSagaData), typeof(MyOwnAbstractBase) });
            builder.ApplyMappings(settings, configuration);
            sessionFactory = configuration.BuildSessionFactory() as SessionFactoryImpl;
        }
        public void Should_throw_if_class_is_derived()
        {
            var builder = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings = new SettingsHolder();
            settings.Set("TypesToScan", new[] { typeof(MyDerivedClassWithRowVersion) });
            
            Assert.Throws<MappingException>(() => builder.ApplyMappings(settings, configuration));
        }
Example #6
0
        public void Should_throw_if_class_is_derived()
        {
            var builder    = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings      = new SettingsHolder();

            settings.Set("TypesToScan", new[] { typeof(MyDerivedClassWithRowVersion) });

            Assert.Throws <MappingException>(() => builder.ApplyMappings(settings, configuration));
        }
Example #7
0
        public void SetUp()
        {
            var builder    = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings      = new SettingsHolder();

            settings.Set("TypesToScan", new[] { typeof(SagaWithAbstractBaseClass), typeof(ContainSagaData), typeof(MyOwnAbstractBase) });
            builder.ApplyMappings(settings, configuration);
            sessionFactory = configuration.BuildSessionFactory() as SessionFactoryImpl;
        }
        public static SessionFactoryImpl Build()
        {
            var types = Types();

            var builder = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings = new SettingsHolder();
            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, configuration);
            return configuration.BuildSessionFactory() as SessionFactoryImpl;
        }
Example #9
0
        public static SessionFactoryImpl Build()
        {
            var types = Types();

            var builder    = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings      = new SettingsHolder();

            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, configuration);
            return(configuration.BuildSessionFactory() as SessionFactoryImpl);
        }
        public static SessionFactoryImpl Build(Type[] types)
        {
            var builder    = new NHibernateSagaStorage();
            var properties = SQLiteConfiguration.InMemory();

            var configuration = new Configuration().AddProperties(properties);
            var settings      = new SettingsHolder();

            var metaModel = new SagaMetadataCollection();

            metaModel.Initialize(types);
            settings.Set <SagaMetadataCollection>(metaModel);

            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, configuration);
            return(configuration.BuildSessionFactory() as SessionFactoryImpl);
        }
Example #11
0
        public static SessionFactoryImpl Build(Type[] types)
        {
            var builder = new NHibernateSagaStorage();

            var cfg = new Configuration()
                      .DataBaseIntegration(x =>
            {
                x.Dialect <MsSql2012Dialect>();
                x.ConnectionString = Consts.SqlConnectionString;
            });

            var settings = new SettingsHolder();

            var metaModel = new SagaMetadataCollection();

            metaModel.Initialize(types);
            settings.Set <SagaMetadataCollection>(metaModel);

            settings.Set("TypesToScan", types);
            builder.ApplyMappings(settings, cfg);
            return(cfg.BuildSessionFactory() as SessionFactoryImpl);
        }