Someone in our company wrote (by mistake, a long time ago) this static class, being served from Nuget : (I can't edit it)
public static class MailService
{
public static void SendEmail(string recipients, string subject, string msg )
{
SendEmail(recipients, subject, msg);
}
...
}
I already know it's bad. But let's continue.
I want to use this class via DI in my asp.net core project.
Problem is that I can't use this (because static
can't be new'ed):
services.AddSingleton<MailService>();
Question:
Is there still a way to make MailService
(or any wrapper for it ) Injectable?