コード例 #1
0
 internal EntityRepositoryFactory(ProviderMetadata providerMetadata,
     AbstractRevisionRepositoryFactory<TypedEntity> revisionRepositoryFactory,
     AbstractSchemaRepositoryFactory schemaRepositoryFactory, Settings settings,
     IFrameworkContext frameworkContext)
     : base(providerMetadata, revisionRepositoryFactory, schemaRepositoryFactory, frameworkContext, new DependencyHelper(settings, providerMetadata))
 {
 }
コード例 #2
0
        public IoHiveTestSetupHelper(string supportedExtensions, FakeFrameworkContext frameworkContext = null)
        {
            FrameworkContext = frameworkContext ?? new FakeFrameworkContext();
            TestDirectory = GetTestDirectory();
            ProviderMetadata = new ProviderMetadata("test-provider", new Uri("storage://"), true, false);
            Settings = new Settings(supportedExtensions, TestDirectory.FullName, TestDirectory.FullName, String.Empty, String.Empty, "~/");
            EntityRepositoryFactory = new EntityRepositoryFactory(ProviderMetadata, null, null, Settings, FrameworkContext);
            EntityRepository = EntityRepositoryFactory.GetRepository() as EntityRepository;

            var readonlyFactory = new ReadonlyProviderUnitFactory(EntityRepositoryFactory);
            var factory = new ProviderUnitFactory(EntityRepositoryFactory);

            ReadonlyProviderSetup = new ReadonlyProviderSetup(readonlyFactory, ProviderMetadata, FrameworkContext, new NoopProviderBootstrapper(), 0);
            ProviderSetup = new ProviderSetup(factory, ProviderMetadata, FrameworkContext, new NoopProviderBootstrapper(), 0);
        }
コード例 #3
0
        public override void Initialise(IBuilderContext builderContext)
        {
            var configMain = builderContext.ConfigurationResolver
                                 .GetConfigSection(HiveConfigSection.ConfigXmlKey) as HiveConfigSection;

            if (configMain == null)
                throw new ConfigurationErrorsException(
                    string.Format("Configuration section '{0}' not found when building packaging provider '{1}'",
                                  HiveConfigSection.ConfigXmlKey, ProviderKey));

            var readWriteConfig = configMain.Providers.ReadWriters[ProviderKey] ?? configMain.Providers.Readers[ProviderKey];

            if (readWriteConfig == null)
                throw new ConfigurationErrorsException(
                    string.Format("No configuration found for persistence provider '{0}'", ProviderKey));

            var deepConfigManager = DeepConfigManager.Default;
            var localConfig = !string.IsNullOrEmpty(readWriteConfig.ConfigSectionKey)
                              ? deepConfigManager.GetFirstWebSetting<ConfigSection, ConfigSection>(readWriteConfig.ConfigSectionKey, x => x, "~/App_Plugins")
                                ??
                                readWriteConfig.GetLocalProviderConfig() as ConfigSection
                              : null;

            _configSection = localConfig;

            // ElementInformation.Source appears to be one of few ways to determine if the config-section exists or was returned on-demand with default values
            if (_configSection != null && !string.IsNullOrEmpty(_configSection.ElementInformation.Source))
            {
                CanBuild = true;
                var supportedExtensions = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.SupportedExtensions, "~/App_Plugins");
                var rootPath = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.RootPath, "~/App_Plugins");
                var excludedExtensions = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.ExcludedExetensions, "~/App_Plugins");
                var excludedDirectories = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.ExcludedDirectories, "~/App_Plugins");
                var rootPublicDomain = deepConfigManager.GetFirstWebSetting<ConfigSection, string>(readWriteConfig.ConfigSectionKey, x => x.RootPublicDomain, "~/App_Plugins");
                rootPath = rootPath.TrimEnd("/") + "/";
                _settings = new Settings(supportedExtensions, "", rootPath, excludedExtensions, excludedDirectories, rootPublicDomain);
            }
            else
            {
                LogHelper.Warn<ProviderDemandBuilder>("Cannot register dependencies for provider {0} because ProviderConfigurationSection was specified with key '{1}' but no matching configSection was found. The provider may not be installed correctly.",
                    ProviderKey,
                    readWriteConfig.ConfigSectionKey);
            }
        }
コード例 #4
0
 public DependencyHelper(Settings settings, ProviderMetadata providerMetadata) : base(providerMetadata)
 {
     Settings = settings;
 }