using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
namespace Kean.Infrastructure.Soap
{
///
/// 服务集合
///
public sealed class ServiceCollection
{
private readonly IServiceCollection _services;
private readonly IList _list = new List();
///
/// 初始化 Kean.Infrastructure.Soap.ServiceCollection 类的新实例
///
/// 服务描述符
internal ServiceCollection(IServiceCollection services) =>
_services = services;
///
/// 添加服务端
///
/// 服务类型
public void Add()
where TService : class
{
_services.AddScoped();
_list.Add(new SoapMapper());
}
///
/// 添加服务端
///
/// 契约类型
/// 业务类型
public void Add()
where TContract : class
where TImplementation : class, TContract
{
_services.AddScoped();
_list.Add(new SoapMapper());
}
///
/// 返回一个循环访问 Soap 映射器集合的枚举器
///
/// 用于循环访问集合的枚举数
public IEnumerator GetEnumerator() =>
_list.GetEnumerator();
}
}