My problem is that I'm trying to pass to the constructor of a custom service some configurations keys that reside in my appsettings.json at the startup time. I want to know how can I achieve this.
This is my setup:
This is the interface for the email service
public interface IEmailService
{
Task<bool> SendEmailAsync(string email, string subject, string message);
}
This is the interface for the parameters that are in the config file
public interface IAWSCredentialsConfig
{
string AccessKeyId { get; }
string SecretAccessKey { get; }
}
An this is the constructor of the implementation of the email service:
public EmailService(IAWSCredentialsConfig config)
{
_config = config;
ClientConfig = new AmazonSimpleEmailServiceConfig
{
RegionEndpoint = RegionEndpoint.USEast1
};
}
How can I inject those two parameters into a Singleton instance of the EmailService?