예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompanyStorageHelper"/> class.
 /// </summary>
 /// <param name="logger">Instance to send logs to the Application Insights service.</param>
 /// <param name="companyResponseStorageProvider">Company response storage provider dependency injection.</param>
 public CompanyStorageHelper(
     ILogger <CompanyStorageHelper> logger,
     ICompanyResponseStorageProvider companyResponseStorageProvider)
 {
     this.logger = logger;
     this.companyResponseStorageProvider = companyResponseStorageProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CompanyResponseController"/> class.
 /// </summary>
 /// <param name="logger">Sends logs to the Application Insights service.</param>
 /// <param name="companyResponseStorageProvider">Company response storage provider dependency injection.</param>
 /// <param name="companyResponseSearchService">The company response search service dependency injection.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 public CompanyResponseController(
     ILogger <CompanyResponseController> logger,
     ICompanyResponseStorageProvider companyResponseStorageProvider,
     ICompanyResponseSearchService companyResponseSearchService,
     TelemetryClient telemetryClient)
     : base(telemetryClient)
 {
     this.logger = logger;
     this.companyResponseStorageProvider = companyResponseStorageProvider;
     this.companyResponseSearchService   = companyResponseSearchService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompanyResponseSearchService"/> class.
        /// </summary>
        /// <param name="optionsAccessor">A set of key/value application configuration properties.</param>
        /// <param name="companyResponseStorageProvider">Company response storage provider dependency injection.</param>
        /// <param name="logger">Instance to send logs to the Application Insights service.</param>
        public CompanyResponseSearchService(
            IOptions <SearchServiceSetting> optionsAccessor,
            ICompanyResponseStorageProvider companyResponseStorageProvider,
            ILogger <CompanyResponseSearchService> logger)
        {
            optionsAccessor = optionsAccessor ?? throw new ArgumentNullException(nameof(optionsAccessor));

            this.options = optionsAccessor.Value;
            var searchServiceValue = this.options.SearchServiceName;

            this.searchServiceClient = new SearchServiceClient(
                searchServiceValue,
                new SearchCredentials(this.options.SearchServiceAdminApiKey));
            this.searchIndexClient = new SearchIndexClient(
                searchServiceValue,
                CompanyResponseIndexName,
                new SearchCredentials(this.options.SearchServiceQueryApiKey));
            this.searchIndexingIntervalInMinutes = Convert.ToInt32(this.options.SearchIndexingIntervalInMinutes, CultureInfo.InvariantCulture);

            this.initializeTask = new Lazy <Task>(() => this.InitializeAsync(this.options.ConnectionString));
            this.companyResponseStorageProvider = companyResponseStorageProvider;
            this.logger = logger;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CannedResponsesActivityHandler"/> class.
 /// </summary>
 /// <param name="logger">Instance to send logs to the Application Insights service.</param>
 /// <param name="localizer">The current cultures' string localizer.</param>
 /// <param name="telemetryClient">The Application Insights telemetry client.</param>
 /// <param name="options">>A set of key/value application configuration properties for activity handler.</param>
 /// <param name="userResponseStorageProvider">User response storage provider to maintain data in Microsoft Azure table storage.</param>
 /// <param name="companyResponseStorageProvider">Company response storage provider to maintain data in Microsoft Azure table storage.</param>
 /// <param name="userResponseSearchService">The user response search service dependency injection.</param>
 /// <param name="companyResponseSearchService">The company response search service dependency injection.</param>
 /// <param name="userState">State management object for maintaining user conversation state.</param>
 /// <param name="microsoftAppCredentials">Microsoft application credentials to send card to the specified team.</param>
 /// <param name="tokenHelper">Generating custom JWT token and retrieving user detail from token.</param>
 /// <param name="botSetting">>A set of key/value application configuration properties for bot.</param>
 /// <param name="telemetrySettings">>Application insights settings.</param>
 /// <param name="userStorageHelper">User storage helper dependency injection.</param>
 /// <param name="companyStorageHelper">Company storage helper dependency injection.</param>
 /// <param name="messagingExtensionHelper">Messaging Extension helper dependency injection.</param>
 /// <param name="conversationStorageProvider">Conversation storage provider to maintain data in Microsoft Azure table storage.</param>
 public CannedResponsesActivityHandler(
     ILogger <CannedResponsesActivityHandler> logger,
     IStringLocalizer <Strings> localizer,
     TelemetryClient telemetryClient,
     IOptions <CannedResponsesActivityHandlerOptions> options,
     IUserResponseStorageProvider userResponseStorageProvider,
     ICompanyResponseStorageProvider companyResponseStorageProvider,
     IUserResponseSearchService userResponseSearchService,
     ICompanyResponseSearchService companyResponseSearchService,
     UserState userState,
     MicrosoftAppCredentials microsoftAppCredentials,
     ITokenHelper tokenHelper,
     IOptions <BotSetting> botSetting,
     IOptions <TelemetrySetting> telemetrySettings,
     IUserStorageHelper userStorageHelper,
     ICompanyStorageHelper companyStorageHelper,
     IMessagingExtensionHelper messagingExtensionHelper,
     IConversationStorageProvider conversationStorageProvider)
 {
     this.logger                         = logger;
     this.localizer                      = localizer;
     this.telemetryClient                = telemetryClient;
     this.options                        = options;
     this.userResponseStorageProvider    = userResponseStorageProvider;
     this.companyResponseStorageProvider = companyResponseStorageProvider;
     this.userResponseSearchService      = userResponseSearchService;
     this.companyResponseSearchService   = companyResponseSearchService;
     this.userState                      = userState;
     this.tokenHelper                    = tokenHelper;
     this.microsoftAppCredentials        = microsoftAppCredentials;
     this.botSetting                     = botSetting;
     this.telemetrySettings              = telemetrySettings;
     this.userStorageHelper              = userStorageHelper;
     this.companyStorageHelper           = companyStorageHelper;
     this.messagingExtensionHelper       = messagingExtensionHelper;
     this.conversationStorageProvider    = conversationStorageProvider;
 }