Files
SteamTools/System.Application.Services.SmsSender/ServiceCollectionExtensions.cs
T
Aigio Liu ec2b665726 sms api
2021-03-05 16:52:00 +08:00

22 lines
877 B
C#

using System.Application.Models;
using System.Application.Services.Implementation;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
/// <summary>
/// 添加短信发送提供商(仅单选一个提供商)
/// </summary>
/// <typeparam name="TSmsSettings"></typeparam>
/// <param name="services"></param>
/// <param name="name">提供商唯一名称,见 <see cref="ISmsSettings.SmsOptions"/> 中 PropertyName</param>
/// <returns></returns>
public static IServiceCollection AddSmsSenderProvider<TSmsSettings>(
this IServiceCollection services,
string? name)
where TSmsSettings : class, ISmsSettings
=> SmsSenderBase.Add<TSmsSettings>(services, name);
}
}