Skip to content

Commit

Permalink
Merge pull request #1 from trenz-gmbh/features/AddRazorEmailRenderer
Browse files Browse the repository at this point in the history
add AddRazorEmailRenderer for more convenient (and correct) setup
  • Loading branch information
chucker authored Nov 17, 2023
2 parents 90dcc4e + 7723d7b commit 2b58c4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 2 additions & 5 deletions TRENZ.Lib.RazorMail.SampleWebApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using TRENZ.Lib.RazorMail.Services;
using TRENZ.Lib.RazorMail.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMvcCore()
.AddRazorViewEngine();

builder.Services.AddTransient<IRazorEmailRenderer, RazorEmailRenderer>();
builder.Services.AddRazorEmailRenderer();

var app = builder.Build();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Extensions.DependencyInjection;

using TRENZ.Lib.RazorMail.Services;

namespace TRENZ.Lib.RazorMail.Extensions;

public static class RazorMailServiceCollectionExtensions
{
public static IServiceCollection AddRazorEmailRenderer(this IServiceCollection services)
{
services.AddMvcCore()
.AddRazorViewEngine();

services.AddTransient<IRazorEmailRenderer, RazorEmailRenderer>();

return services;
}
}

0 comments on commit 2b58c4b

Please sign in to comment.