public static void AddNotifications(this IServiceCollection services, IConfiguration configuration) { var providerString = configuration["NotificationProviders"]; var providers = providerString.Split(','); if (providers.Contains(NotificationProvider.SmtpEmail)) { services.AddSmtpEmailSender(configuration); } NotificationConfig.InitConfigFile().Wait(); services.AddTransient <NotificationConfig>(); services.AddTransient <INotificationProvider, NotificationProvider>(); }