trenz-gmbh / TRENZ.Lib.RazorMail

Templated transactional e-mail using Razor
MIT License
2 stars 0 forks source link

Make RazorMail independent of ASP.NET #7

Open ricardoboss opened 10 months ago

ricardoboss commented 10 months ago

Is it possible to remove the dependency on ASP.NET?

Currently, when using the following code, I get some obscure error messages about service that are not registered:

var builder = Host.CreateDefaultBuilder(args)

builder.AddRazorEmailRenderer();

var host = builder.Build();

await host.RunAsync();

It would be nice to be able to use the razor pipeline without a hard dependency on ASP.NET.

The workaround currently consists of replacing the builder with a ASP.NET web app builder:

var builder = WebApplication.CreateBuilder(args);

// ...

Also, all services using the IRazorEmailRenderer need to be scoped, which ideally would not be necessary.

chucker commented 10 months ago

See also prototypes/console-sample-app branch