using Microsoft.Extensions.DependencyInjection; using SoapCore; using System; namespace Kean.Infrastructure.Soap { /// /// ServiceCollection 扩展方法 /// public static class ServiceCollectionExtensions { /// /// 向服务描述中追加 Soap 配置 /// /// 服务描述符 /// 配置项 /// 服务描述符 public static IServiceCollection AddSoap(this IServiceCollection services, Action setupAction) { services.AddSoapCore(); var options = new SoapOptions { Services = new(services) }; setupAction.Invoke(options); return services.AddTransient(_ => options.Services); } } }