using System.Globalization; using System.Text.Encodings.Web; using AntDesign; using AntDesign.JsInterop; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { public static IServiceCollection AddAntDesign(this IServiceCollection services) { services.TryAddScoped(); services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService(), s => HtmlEncoder.Default.Encode(s))) ); services.TryAddSingleton(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CurrentCulture; return services; } } }