public interface ISmsSender { Task SendSmsAsync(string phoneNumber, string message); }
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; namespace MyApp { public class MySmsService : IIdentityMessageService { private readonly ISmsSender _smsSender; public MySmsService(ISmsSender smsSender) { _smsSender = smsSender; } public async Task SendAsync(IdentityMessage message) { await _smsSender.SendSmsAsync(message.Destination, message.Body); } } }In this example, we have a custom implementation of the IIdentityMessageService interface which is used by the ASP.NET Identity framework to send SMS messages for two-factor authentication. The MySmsService class accepts an ISmsSender implementation as a dependency, and forwards any SMS messages to be sent to the underlying implementation of the SendSmsAsync method using the `_smsSender` object. Overall, the ISmsSender interface is part of various libraries and frameworks in the .NET ecosystem that need to send SMS messages for various reasons.