Ejemplo n.º 1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            var persistenceConfig = ConfigurationManager.GetSection(HiveConfigurationSection.ConfigXmlKey) as HiveConfigurationSection;

            var localConfig = persistenceConfig.AvailableProviders.ReadWriters["rw-xmlstore-01"].GetLocalProviderConfig() as ProviderConfigurationSection;

            Assert.IsNotNull(localConfig);

            var dataPath = TestHelper.MapPathForTest(localConfig.Path);

            // Setup the local provider
            var dataContextFactory = new DataContextFactory(dataPath);
            var unitOfWorkFactory  = new ReadWriteRepositoryUnitOfWorkFactory(dataContextFactory);

            _xmlReader = new Reader(unitOfWorkFactory);
            var readWriter = new ReadWriter(unitOfWorkFactory);

            var uriMatch = new DefaultUriMatch()
            {
                MatchType = UriMatchElement.MatchTypes.Wildcard, Uri = "content://*/"
            };

            // Setup hive's provider governor. Normally it takes two uow factories (read and read-write) but we can use the same for both here
            _mappingGroup = new DefaultPersistenceMappingGroup("rw-demodata-01", new[] { unitOfWorkFactory }, new[] { unitOfWorkFactory }, new[] { _xmlReader }, new[] { readWriter }, new[] { uriMatch });
        }
Ejemplo n.º 2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            var frameworkContext =
                new FrameworkContext(
                    ConfigurationManager.GetSection("rebel.foundation") as IFoundationConfigurationSection);

            var persistenceConfig = ConfigurationManager.GetSection("hive.persistence") as HiveConfigurationSection;

            var localConfig = persistenceConfig.AvailableProviders.ReadWriters["rw-nhibernate-01"].GetLocalProviderConfig() as ProviderConfigurationSection;

            var nhSetup = new NHibernateConfigBuilder("rw-nhibernate-01", localConfig);
            var config  = nhSetup.BuildConfiguration();

            // Setup the local provider
            var dataContextFactory = new DataContextFactory(config.BuildSessionFactory());
            var unitOfWorkFactory  = new ReadWriteRepositoryUnitOfWorkFactory(dataContextFactory);
            var reader             = new Reader(unitOfWorkFactory);
            var readWriter         = new ReadWriter(unitOfWorkFactory);

            var uriMatch = new DefaultUriMatch()
            {
                MatchType = UriMatchElement.MatchTypes.Wildcard, Uri = "content://*/"
            };

            // Setup hive's provider governor. Normally it takes two uow factories (read and read-write) but we can use the same for both here
            _mappingGroup = new DefaultPersistenceMappingGroup("rw-nhibernate-01", new[] { unitOfWorkFactory }, new[] { unitOfWorkFactory }, new[] { reader }, new[] { readWriter }, new[] { uriMatch });
        }
Ejemplo n.º 3
0
        public static void MyClassInitialize(TestContext testContext)
        {
            var persistenceConfig = ConfigurationManager.GetSection(HiveConfigurationSection.ConfigXmlKey) as HiveConfigurationSection;

            var localConfig = persistenceConfig.AvailableProviders.ReadWriters["rw-xmlstore-01"].GetLocalProviderConfig() as ProviderConfigurationSection;

            Assert.IsNotNull(localConfig);

            var dataPath = TestHelper.MapPathForTest(localConfig.Path);

            // Setup the local provider
            var dataContextFactory = new DataContextFactory(dataPath);
            var unitOfWorkFactory = new ReadWriteRepositoryUnitOfWorkFactory(dataContextFactory);
            _xmlReader = new Reader(unitOfWorkFactory);
            var readWriter = new ReadWriter(unitOfWorkFactory);

            var uriMatch = new DefaultUriMatch() { MatchType = UriMatchElement.MatchTypes.Wildcard, Uri = "content://*/" };

            // Setup hive's provider governor. Normally it takes two uow factories (read and read-write) but we can use the same for both here
            _mappingGroup = new DefaultPersistenceMappingGroup("rw-demodata-01", new[] { unitOfWorkFactory }, new[] { unitOfWorkFactory }, new[] { _xmlReader }, new[] { readWriter }, new[] { uriMatch });
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            var frameworkContext =
                new FrameworkContext(
                    ConfigurationManager.GetSection("umbraco.foundation") as IFoundationConfigurationSection);

            var persistenceConfig = ConfigurationManager.GetSection("hive.persistence") as HiveConfigurationSection;

            var localConfig = persistenceConfig.AvailableProviders.ReadWriters["rw-nhibernate-01"].GetLocalProviderConfig() as ProviderConfigurationSection;

            var nhSetup = new NHibernateConfigBuilder("rw-nhibernate-01", localConfig);
            var config = nhSetup.BuildConfiguration();

            // Setup the local provider
            var dataContextFactory = new DataContextFactory(config.BuildSessionFactory());
            var unitOfWorkFactory = new ReadWriteRepositoryUnitOfWorkFactory(dataContextFactory);
            var reader = new Reader(unitOfWorkFactory);
            var readWriter = new ReadWriter(unitOfWorkFactory);

            var uriMatch = new DefaultUriMatch() {MatchType = UriMatchElement.MatchTypes.Wildcard, Uri = "content://*/"};

            // Setup hive's provider governor. Normally it takes two uow factories (read and read-write) but we can use the same for both here
            _mappingGroup = new DefaultPersistenceMappingGroup("rw-nhibernate-01", new[] { unitOfWorkFactory }, new[] { unitOfWorkFactory }, new[] { reader }, new[] { readWriter }, new[]{uriMatch});
        }