Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Vallet authored and Lionel Vallet committed Sep 20, 2022
1 parent 7051c04 commit d15c1eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
23 changes: 12 additions & 11 deletions src/EmailServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public static class EmailServiceCollectionExtensions
{
public static IServiceCollection AddRazorEmails(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));

return services
return services == null
? throw new ArgumentNullException(nameof(services))
: services
.AddScoped<IRazorViewToStringRenderer, RazorViewToStringRenderer>()
.AddScoped<IEmailService, EmailService>();
}

public static IServiceCollection AddRazorEmails(this IServiceCollection services, IConfiguration? configuration = null)
{
if (services == null) throw new ArgumentNullException(nameof(services));

return services
return services == null
? throw new ArgumentNullException(nameof(services))
: services
.AddRazorEmails()
.AddOptions<EmailOptions>()
.Bind(configuration)
Expand All @@ -35,9 +35,9 @@ public static IServiceCollection AddRazorEmails(this IServiceCollection services

public static IServiceCollection AddRazorEmails(this IServiceCollection services, Action<EmailOptions> emailOptions)
{
if (services == null) throw new ArgumentNullException(nameof(services));

return services
return services == null
? throw new ArgumentNullException(nameof(services))
: services
.AddRazorEmails()
.AddOptions<EmailOptions>()
.Configure(emailOptions)
Expand All @@ -47,8 +47,9 @@ public static IServiceCollection AddRazorEmails(this IServiceCollection services

private static OptionsBuilder<EmailOptions> ValidateEmailOptions(this OptionsBuilder<EmailOptions> optionsBuilder)
{
if (optionsBuilder == null) throw new ArgumentNullException(nameof(optionsBuilder));
return optionsBuilder
return optionsBuilder == null
? throw new ArgumentNullException(nameof(optionsBuilder))
: optionsBuilder
.ValidateDataAnnotationsRecursively()
.Validate<ILogger<EmailService>>(ValidateSmtpOptions, "Failed to connect to SMTP server")
.ValidateOnStart();
Expand Down
5 changes: 1 addition & 4 deletions src/ReHackt.RazorEmails.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
<PackageTags>aspnetcore, email, razor, smtp</PackageTags>
<PackageReleaseNotes>https://github.com/LionelVallet/ReHackt.RazorEmails/releases</PackageReleaseNotes>
<Description>Provides an email layout to create email templates with Razor and tag helpers, and a service to send emails using SMTP.</Description>
<Version>6.0.2</Version>
<Version>6.0.3</Version>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="MailKit" Version="3.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="ReHackt.Extensions.Options.Validation" Version="6.0.3" />
</ItemGroup>
Expand Down

0 comments on commit d15c1eb

Please sign in to comment.