/// <summary> /// Initializes a new instance of the <see cref="TicketSearchService"/> 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="ticketDetailStorageProvider"> TicketsProvider provided by dependency injection.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> public TicketSearchService( IOptionsMonitor <SearchServiceOptions> searchServiceOptions, IOptionsMonitor <StorageOptions> storageOptions, ITicketDetailStorageProvider ticketDetailStorageProvider, ILogger <TicketSearchService> logger) { 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, TicketsIndexName, new SearchCredentials(this.searchServiceOptions.SearchServiceQueryApiKey)); this.searchIndexingIntervalInMinutes = Convert.ToInt32(this.searchServiceOptions.SearchIndexingIntervalInMinutes, CultureInfo.InvariantCulture); this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(storageOptions.CurrentValue.ConnectionString)); this.ticketDetailStorageProvider = ticketDetailStorageProvider; this.logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="AwardNominationSearchService"/> 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 AwardNominationSearchService( IOptionsMonitor <SearchServiceOptions> searchServiceOptions, IOptionsMonitor <StorageOptions> storageOptions, IAwardNominationStorageProvider nominateAwardStorageProvider) { searchServiceOptions = searchServiceOptions ?? throw new ArgumentNullException(nameof(searchServiceOptions)); storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions)); this.searchServiceOptions = searchServiceOptions.CurrentValue; var searchDnsSuffix = this.searchServiceOptions.IsGccHybridDeployment ? "search.azure.us" : "search.windows.net"; this.searchServiceClient = new SearchServiceClient( this.searchServiceOptions.SearchServiceName, new SearchCredentials(this.searchServiceOptions.SearchServiceAdminApiKey)) { SearchDnsSuffix = searchDnsSuffix, }; this.searchIndexClient = new SearchIndexClient( this.searchServiceOptions.SearchServiceName, NominateDetailIndexName, new SearchCredentials(this.searchServiceOptions.SearchServiceQueryApiKey)) { SearchDnsSuffix = searchDnsSuffix, }; this.nominateAwardStorageProvider = nominateAwardStorageProvider; this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(storageOptions.CurrentValue.ConnectionString)); }
/// <summary> /// Initializes a new instance of the <see cref="PersonalGoalSearchService"/> class. /// </summary> /// <param name="searchServiceOptions">A set of key/value Azure Search Service configuration properties.</param> /// <param name="storageOptions">A set of key/value application storage configuration properties.</param> /// <param name="logger">Instance to send logs to the Application Insights service.</param> /// <param name="searchServiceClient">Instance of Azure Search service client.</param> /// <param name="searchIndexClient">Instance of Azure Search index client.</param> public PersonalGoalSearchService( IOptions <SearchServiceOptions> searchServiceOptions, IOptionsMonitor <StorageOptions> storageOptions, ILogger <PersonalGoalSearchService> logger, SearchServiceClient searchServiceClient, SearchIndexClient searchIndexClient) { searchServiceOptions = searchServiceOptions ?? throw new ArgumentNullException(nameof(searchServiceOptions)); storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions)); this.searchServiceOptions = searchServiceOptions.Value; var searchServiceValue = this.searchServiceOptions.SearchServiceName; this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(storageOptions.CurrentValue.ConnectionString)); this.searchServiceClient = searchServiceClient; this.searchIndexClient = searchIndexClient; this.logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="AwardNominationSearchService"/> 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 AwardNominationSearchService( IOptionsMonitor <SearchServiceOptions> searchServiceOptions, IOptionsMonitor <StorageOptions> storageOptions, IAwardNominationStorageProvider 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.nominateAwardStorageProvider = nominateAwardStorageProvider; this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(storageOptions.CurrentValue.ConnectionString)); }