Пример #1
0
        // protected readonly ISessionFactory sessionFactory;

        public InMemoryDatabaseTest()
        {
            var configuration = Fluently.Configure()
                                .Database(() => SQLiteConfiguration.Standard.InMemory())

                                .Mappings(x => x.FluentMappings.AddFromAssembly(typeof(UserMap).Assembly))
                                .ExposeConfiguration(x =>
            {
                x.SetProperty(NHibernate.Cfg.Environment.ReleaseConnections, "on_close");
            });
            var sessionSource = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(configuration);

            sessionSource.BuildSchema();
            Session = sessionSource.CreateSession();


            //var assemblyMapping = Assembly.Load("Cloudents.Persistence");
            //var configuration = Fluently.Configure()
            //    .Database(() => SQLiteConfiguration.Standard.InMemory().ShowSql().DefaultSchema("sb"))

            //    .Mappings(x => x.FluentMappings.AddFromAssembly(assemblyMapping))
            //    .ExposeConfiguration(
            //            cfg =>
            //            {
            //                 //cfg.DataBaseIntegration(dbi => dbi.SchemaAction = SchemaAutoAction.Validate);
            //            });
            //var sessionFactory = configuration.BuildSessionFactory();
            //Session = sessionFactory.OpenSession();
            //new SchemaExport(configuration.BuildConfiguration()).Execute(true, true, false, Session.Connection, Console.Out);
        }
        public void SetUp()
        {
            var properties = CreateStandardConfiguration()
                             .UseOuterJoin()
                             .ShowSql()
                             .InMemory()
                             .ToProperties();

            _source = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(properties, new MusicPersistenceModel());
            _source.BuildSchema();
        }
        public void Use_this_to_generate_the_database_schema_when_needed_by_default_it_is_ignored()
        {
            var configuration        = new SQLServerPersistenceConfiguration(@"RCKLIENT45\SQLEXPRESS", "Fohjin.Blog");
            var autoPersistenceModel = new NHibernatePersistenceModel();

            var config = new Configuration();

            configuration.GetConfiguration().ConfigureProperties(config);

            _source = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(config.Properties, autoPersistenceModel.GetPersistenceModel());
            _source.BuildSchema();
        }
        public void SetUp()
        {
            var properties = new SQLiteConfiguration()
                             .UseOuterJoin()
                             //.ShowSql()
                             .InMemory()
                             .ToProperties();

            var autoPersistenceModel = new NHibernatePersistenceModel().GetPersistenceModel();

            _source = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(properties, autoPersistenceModel);
            _source.BuildSchema();
        }
Пример #5
0
        public void SetUp()
        {
            var properties = new SQLiteConfiguration()
                             .UseOuterJoin()
                             //.ShowSql()
                             .InMemory()
                             .ToProperties();

            _persistenceModel = new TestPersistenceModel <MAPTYPE, ENTITY>();

            ReferencesAdditionalMaps(_persistenceModel);

            _source = new SingleConnectionSessionSourceForSQLiteInMemoryTesting(properties, _persistenceModel);
            _source.BuildSchema();
        }