示例#1
0
        private static void RegisterAuxiliaryDataStorageServices(ContainerBuilder containerBuilder, string key)
        {
            containerBuilder
            .Register <ICloudBlobClient>(c =>
            {
                var options = c.Resolve <IOptionsSnapshot <AuxiliaryDataStorageConfiguration> >();
                return(new CloudBlobClientWrapper(
                           options.Value.AuxiliaryDataStorageConnectionString,
                           DefaultBlobRequestOptions.Create()));
            })
            .Keyed <ICloudBlobClient>(key);

            containerBuilder
            .Register <IAuxiliaryFileClient>(c => new AuxiliaryFileClient(
                                                 c.ResolveKeyed <ICloudBlobClient>(key),
                                                 c.Resolve <IOptionsSnapshot <AuxiliaryDataStorageConfiguration> >(),
                                                 c.Resolve <IAzureSearchTelemetryService>(),
                                                 c.Resolve <ILogger <AuxiliaryFileClient> >()));
        }
示例#2
0
        public static ContainerBuilder AddCatalog2Registration(this ContainerBuilder containerBuilder)
        {
            RegisterCursorStorage(containerBuilder);

            containerBuilder
            .Register <ICloudBlobClient>(c =>
            {
                var options = c.Resolve <IOptionsSnapshot <Catalog2RegistrationConfiguration> >();
                return(new CloudBlobClientWrapper(
                           options.Value.StorageConnectionString,
                           DefaultBlobRequestOptions.Create()));
            });

            containerBuilder.Register(c => new Catalog2RegistrationCommand(
                                          c.Resolve <ICollector>(),
                                          c.Resolve <ICloudBlobClient>(),
                                          c.ResolveKeyed <IStorageFactory>(CursorBindingKey),
                                          c.Resolve <Func <HttpMessageHandler> >(),
                                          c.Resolve <IOptionsSnapshot <Catalog2RegistrationConfiguration> >(),
                                          c.Resolve <ILogger <Catalog2RegistrationCommand> >()));

            return(containerBuilder);
        }
示例#3
0
        private static void RegisterAzureSearchStorageServices(ContainerBuilder containerBuilder, string key)
        {
            containerBuilder
            .Register <ICloudBlobClient>(c =>
            {
                var options = c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >();
                return(new CloudBlobClientWrapper(
                           options.Value.StorageConnectionString,
                           DefaultBlobRequestOptions.Create()));
            })
            .Keyed <ICloudBlobClient>(key);

            containerBuilder
            .Register <IVersionListDataClient>(c => new VersionListDataClient(
                                                   c.ResolveKeyed <ICloudBlobClient>(key),
                                                   c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                                   c.Resolve <ILogger <VersionListDataClient> >()));

            containerBuilder
            .Register(c =>
            {
                var options = c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >();
                return(CloudStorageAccount.Parse(options.Value.StorageConnectionString));
            })
            .Keyed <CloudStorageAccount>(key);

            containerBuilder
            .Register <IStorageFactory>(c =>
            {
                var options = c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >();
                return(new AzureStorageFactory(
                           c.ResolveKeyed <CloudStorageAccount>(key),
                           options.Value.StorageContainer,
                           maxExecutionTime: AzureStorage.DefaultMaxExecutionTime,
                           serverTimeout: AzureStorage.DefaultServerTimeout,
                           path: options.Value.NormalizeStoragePath(),
                           baseAddress: null,
                           useServerSideCopy: true,
                           compressContent: false,
                           verbose: true,
                           initializeContainer: false,
                           throttle: NullThrottle.Instance));
            })
            .Keyed <IStorageFactory>(key);

            containerBuilder
            .Register <IBlobContainerBuilder>(c => new BlobContainerBuilder(
                                                  c.ResolveKeyed <ICloudBlobClient>(key),
                                                  c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                                  c.Resolve <ILogger <BlobContainerBuilder> >()));

            containerBuilder
            .Register <IDownloadDataClient>(c => new DownloadDataClient(
                                                c.ResolveKeyed <ICloudBlobClient>(key),
                                                c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                                c.Resolve <IAzureSearchTelemetryService>(),
                                                c.Resolve <ILogger <DownloadDataClient> >()));

            containerBuilder
            .Register <IVerifiedPackagesDataClient>(c => new VerifiedPackagesDataClient(
                                                        c.ResolveKeyed <ICloudBlobClient>(key),
                                                        c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                                        c.Resolve <IAzureSearchTelemetryService>(),
                                                        c.Resolve <ILogger <VerifiedPackagesDataClient> >()));

            containerBuilder
            .Register <IOwnerDataClient>(c => new OwnerDataClient(
                                             c.ResolveKeyed <ICloudBlobClient>(key),
                                             c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                             c.Resolve <IAzureSearchTelemetryService>(),
                                             c.Resolve <ILogger <OwnerDataClient> >()));

            containerBuilder
            .Register <IPopularityTransferDataClient>(c => new PopularityTransferDataClient(
                                                          c.ResolveKeyed <ICloudBlobClient>(key),
                                                          c.Resolve <IOptionsSnapshot <AzureSearchConfiguration> >(),
                                                          c.Resolve <IAzureSearchTelemetryService>(),
                                                          c.Resolve <ILogger <PopularityTransferDataClient> >()));

            containerBuilder
            .Register(c => new Catalog2AzureSearchCommand(
                          c.Resolve <ICollector>(),
                          c.ResolveKeyed <IStorageFactory>(key),
                          c.Resolve <Func <HttpMessageHandler> >(),
                          c.Resolve <IBlobContainerBuilder>(),
                          c.Resolve <IIndexBuilder>(),
                          c.Resolve <IOptionsSnapshot <Catalog2AzureSearchConfiguration> >(),
                          c.Resolve <ILogger <Catalog2AzureSearchCommand> >()));

            containerBuilder
            .Register(c => new Db2AzureSearchCommand(
                          c.Resolve <INewPackageRegistrationProducer>(),
                          c.Resolve <IPackageEntityIndexActionBuilder>(),
                          c.Resolve <IBlobContainerBuilder>(),
                          c.Resolve <IIndexBuilder>(),
                          c.Resolve <Func <IBatchPusher> >(),
                          c.Resolve <ICatalogClient>(),
                          c.ResolveKeyed <IStorageFactory>(key),
                          c.Resolve <IOwnerDataClient>(),
                          c.Resolve <IDownloadDataClient>(),
                          c.Resolve <IVerifiedPackagesDataClient>(),
                          c.Resolve <IPopularityTransferDataClient>(),
                          c.Resolve <IOptionsSnapshot <Db2AzureSearchConfiguration> >(),
                          c.Resolve <IOptionsSnapshot <Db2AzureSearchDevelopmentConfiguration> >(),
                          c.Resolve <ILogger <Db2AzureSearchCommand> >()));
        }