Пример #1
0
        public RedisCacheIntegrationTests()
        {
            fakeClientManager = new StoppableRedisClientManager(this.ClientManager);
            RedisCacheProvider.InternalSetClientManager(fakeClientManager);

            if (File.Exists("tests.db"))
            {
                File.Delete("tests.db");
            }

            if (configuration == null)
            {
                configuration = Fluently.Configure()
                                .Database(
                    SQLiteConfiguration.Standard.UsingFile("tests.db")
                    )
                                .Mappings(m =>
                {
                    m.FluentMappings.Add(typeof(PersonMapping));
                })
                                .ExposeConfiguration(cfg =>
                {
                    cfg.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "true");
                })
                                .Cache(c =>
                {
                    c.UseQueryCache().UseSecondLevelCache().ProviderClass <RedisCacheProvider>();
                })
                                .BuildConfiguration();
            }

            new SchemaExport(configuration).Create(false, true);
        }
        public RedisCacheIntegrationTests()
        {
            fakeClientManager = new StoppableRedisClientManager(this.ClientManager);
            RedisCacheProvider.InternalSetClientManager(fakeClientManager);

            if (File.Exists("tests.db")) { File.Delete("tests.db"); }

            if (configuration == null)
            {
                configuration = Fluently.Configure()
                    .Database(
                        SQLiteConfiguration.Standard.UsingFile("tests.db")
                    )
                    .Mappings(m =>
                    {
                        m.FluentMappings.Add(typeof(PersonMapping));
                    })
                    .ExposeConfiguration(cfg =>
                    {
                        cfg.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "true");
                    })
                    .Cache(c =>
                    {
                        c.UseQueryCache().UseSecondLevelCache().ProviderClass<RedisCacheProvider>();
                    })
                    .BuildConfiguration();
            }

            new SchemaExport(configuration).Create(false, true);
        }