/// <summary> /// ctor /// </summary> /// <param name="sendGridEmailSettings"></param> public SendGridEmailSender(IOptions <SendGridEmailSettings> sendGridEmailSettings) { _sendGridEmailSettings = sendGridEmailSettings.Value ?? throw new ArgumentNullException(nameof(sendGridEmailSettings)); .
public SendGridService(IOptions <SendGridEmailSettings> emailOptions) { _emailSettings = emailOptions.Value; }
public EmailsApiController(IEmailSender emailService, IOptions <SendGridEmailSettings> emailOptions) { _emailService = emailService; _emailSettings = emailOptions.Value; }
public static IServiceCollection RegisterSendGridEmailSender(this IServiceCollection services, SendGridEmailSettings model) { return(services .AddSingleton(model) .AddScoped <IEmailSender, SendGridEmailSender>()); }
/// <summary> /// ctor /// </summary> /// <param name="sendGridEmailSettings"></param> public SendGridEmailService(IOptions <SendGridEmailSettings> sendGridEmailSettings) { _sendGridEmailSettings = sendGridEmailSettings.Value ?? throw new ArgumentNullException(nameof(sendGridEmailSettings)); _sendGridClient = new SendGridClient(_sendGridEmailSettings.SendGridApiKey); }
public SendGridEmailSender(SendGridEmailSettings settings) { Settings = settings; Client = new SendGridClient(Settings.ApiKey); }