Ejemplo n.º 1
0
        public void InitializeBlobProviders(ConnectionStringOptions connectionStrings)
        {
            // add built-in provider manually if necessary
            if (!BlobProviders.Values.Any(bp => bp is IBuiltInBlobProvider))
            {
                BlobProviders.AddProvider(new BuiltInBlobProvider(Options.Create(DataOptions.GetLegacyConfiguration()),
                                                                  Options.Create(connectionStrings)));
            }

            if (BlobProviderSelector == null)
            {
                BlobProviderSelector = new BuiltInBlobProviderSelector(BlobProviders,
                                                                       null, Options.Create(BlobStorageOptions.GetLegacyConfiguration()));
            }

            if (BlobMetaDataProvider == null)
            {
                BlobMetaDataProvider = new MsSqlBlobMetaDataProvider(BlobProviders,
                                                                     Options.Create(DataOptions.GetLegacyConfiguration()),
                                                                     Options.Create(BlobStorageOptions.GetLegacyConfiguration()),
                                                                     Options.Create(connectionStrings));
            }

            // assemble the main api instance if necessary (for tests)
            if (BlobStorage == null)
            {
                BlobStorage = new ContentRepository.Storage.Data.BlobStorage(
                    BlobProviders,
                    BlobProviderSelector,
                    BlobMetaDataProvider,
                    Options.Create(BlobStorageOptions.GetLegacyConfiguration()));
            }

            BlobStorage.Initialize();
        }
Ejemplo n.º 2
0
        public void ResetBlobProviders(ConnectionStringOptions connectionStrings)
        {
            BlobStorage          = null;
            BlobProviderSelector = null;
            BlobMetaDataProvider = null;
            BlobProviders.Clear();

            // add default internal blob provider
            BlobProviders.AddProvider(new BuiltInBlobProvider(Options.Create(DataOptions.GetLegacyConfiguration()),
                                                              Options.Create(connectionStrings)));
        }