/// <summary> /// Initializes a new instance of the <see cref="MSGraphNotificationProvider"/> class. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="emailAccountManager">Instance of <see cref="IEmailAccountManager"/>.</param> /// <param name="logger">Instance of <see cref="ILogger"/>.</param> /// <param name="mSGraphSetting">Instance of <see cref="IEmailManager"/>.</param> /// <param name="pollyRetrySetting">Instance of <see cref="RetrySetting"/>.</param> /// <param name="tokenHelper">Instance of <see cref="ITokenHelper"/>.</param> /// <param name="msGraphProvider">Instance of <see cref="IMSGraphProvider"/>.</param> /// <param name="emailManager">Instance of <see cref="IEmailManager"/>..</param> public MSGraphNotificationProvider( IConfiguration configuration, IEmailAccountManager emailAccountManager, ILogger logger, IOptions <MSGraphSetting> mSGraphSetting, IOptions <RetrySetting> pollyRetrySetting, ITokenHelper tokenHelper, IMSGraphProvider msGraphProvider, IEmailManager emailManager) { this.configuration = configuration; this.applicationAccounts = JsonConvert.DeserializeObject <List <ApplicationAccounts> >(this.configuration?["ApplicationAccounts"]); this.emailAccountManager = emailAccountManager; this.logger = logger; _ = int.TryParse(this.configuration["RetrySetting:MaxRetries"], out this.maxTryCount); if (this.configuration?["MailSettings"] != null) { this.mailSettings = JsonConvert.DeserializeObject <List <MailSettings> >(this.configuration?["MailSettings"]); } this.mSGraphSetting = mSGraphSetting?.Value; this.pollyRetrySetting = pollyRetrySetting?.Value; this.jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(), NullValueHandling = NullValueHandling.Ignore, }; this.tokenHelper = tokenHelper; this.msGraphProvider = msGraphProvider; this.emailManager = emailManager; }
/// <summary> /// Initializes a new instance of the <see cref="MSGraphNotificationProvider"/> class. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="emailAccountManager">Instance of <see cref="IEmailAccountManager"/>.</param> /// <param name="logger">Instance of <see cref="ILogger"/>.</param> /// <param name="mSGraphSetting">Instance of <see cref="IEmailManager"/>.</param> /// <param name="tokenHelper">Instance of <see cref="ITokenHelper"/>.</param> /// <param name="msGraphProvider">Instance of <see cref="IMSGraphProvider"/>.</param> /// <param name="emailManager">Instance of <see cref="IEmailManager"/>..</param> public MSGraphNotificationProvider( IConfiguration configuration, IEmailAccountManager emailAccountManager, ILogger logger, IOptions <MSGraphSetting> mSGraphSetting, ITokenHelper tokenHelper, IMSGraphProvider msGraphProvider, IEmailManager emailManager) { this.configuration = configuration; this.applicationAccounts = JsonConvert.DeserializeObject <List <ApplicationAccounts> >(this.configuration?[ConfigConstants.ApplicationAccountsConfigSectionKey]); this.emailAccountManager = emailAccountManager; this.logger = logger; _ = int.TryParse(this.configuration[$"{ConfigConstants.RetrySettingConfigSectionKey}:{ConfigConstants.RetrySettingMaxRetryCountConfigKey}"], out this.maxTryCount); if (this.configuration?[ConfigConstants.MailSettingsConfigKey] != null) { this.mailSettings = JsonConvert.DeserializeObject <List <MailSettings> >(this.configuration?[ConfigConstants.MailSettingsConfigKey]); } this.mSGraphSetting = mSGraphSetting?.Value; this.tokenHelper = tokenHelper; this.msGraphProvider = msGraphProvider; this.emailManager = emailManager; }