예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NominateDetailSearchService"/> class.
        /// </summary>
        /// <param name="searchServiceOptions">A set of key/value application configuration properties.</param>
        /// <param name="storageOptions">A set of key/value application storage configuration properties.</param>
        /// <param name="nominateAwardStorageProvider">Provider to store on nomination details in Azure table storage.</param>
        public NominateDetailSearchService(
            IOptionsMonitor <SearchServiceOptions> searchServiceOptions,
            IOptionsMonitor <StorageOptions> storageOptions,
            INominateAwardStorageProvider nominateAwardStorageProvider)
        {
            searchServiceOptions = searchServiceOptions ?? throw new ArgumentNullException(nameof(searchServiceOptions));
            storageOptions       = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));

            this.searchServiceOptions = searchServiceOptions.CurrentValue;
            string searchServiceValue = this.searchServiceOptions.SearchServiceName;

            this.searchServiceClient = new SearchServiceClient(
                searchServiceValue,
                new SearchCredentials(this.searchServiceOptions.SearchServiceAdminApiKey));
            this.searchIndexClient = new SearchIndexClient(
                searchServiceValue,
                NominateDetailIndexName,
                new SearchCredentials(this.searchServiceOptions.SearchServiceQueryApiKey));
            this.searchIndexingIntervalInMinutes = Convert.ToInt32(this.searchServiceOptions.SearchIndexingIntervalInMinutes, CultureInfo.InvariantCulture);
            this.nominateAwardStorageProvider    = nominateAwardStorageProvider;
            this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(storageOptions.CurrentValue.ConnectionString));
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NominateDetailController"/> class.
 /// </summary>
 /// <param name="logger">Sends logs to the Application Insights service.</param>
 /// <param name="storageProvider">Nominate award detail storage provider.</param>
 /// <param name="endorseStorageProvider">Endorse detail storage provider.</param>
 public NominateDetailController(ILogger <AwardsController> logger, INominateAwardStorageProvider storageProvider, IEndorseDetailStorageProvider endorseStorageProvider)
 {
     this.logger                 = logger;
     this.storageProvider        = storageProvider;
     this.endorseStorageProvider = endorseStorageProvider;
 }