Factory pattern structure written with .net5 for sms services
NETGSM,SMSVITRINI,ILETIMERKEZI,MASGSM
PM> Install-Package ESms
services.AddSingleton<ISmsProviderFactory, SmsProviderFactory>();
PM> Injection
private readonly ISmsProvider _smsProvider;
public SmsController(ISmsProviderFactory SmsService)
{
_smsProvider = smsProvider.Create(SmsTypes.NETGSM, "Username", "Password", "TITLE");
}
PM> Using
public async Task SendSms(string phonenumber, string messagecontent) => await _smsProvider.SendAsync(phonenumber, messagecontent);
public async Task<double> GetCredit() => await _smsProvider.GetCreditAsync();