2019-12-11 17:17:58 +08:00
|
|
|
|
using System.Net.Http;
|
2020-03-11 17:15:15 +08:00
|
|
|
|
using System.Text.Encodings.Web;
|
2020-05-29 00:33:49 +08:00
|
|
|
|
using AntDesign;
|
|
|
|
|
using AntDesign.JsInterop;
|
2019-12-11 17:17:58 +08:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
2020-03-11 17:15:15 +08:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2019-12-11 17:17:58 +08:00
|
|
|
|
|
2020-03-30 14:33:39 +08:00
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
2019-12-11 17:17:58 +08:00
|
|
|
|
{
|
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
{
|
2020-05-29 00:33:49 +08:00
|
|
|
|
public static IServiceCollection AddAntDesign(this IServiceCollection services)
|
2019-12-11 17:17:58 +08:00
|
|
|
|
{
|
2019-12-13 12:43:16 +08:00
|
|
|
|
services.TryAddSingleton<HttpClient>();
|
2019-12-16 18:48:03 +08:00
|
|
|
|
services.TryAddScoped<DomEventService>();
|
2020-03-30 14:33:39 +08:00
|
|
|
|
services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService<ILoggerFactory>(),
|
|
|
|
|
s => HtmlEncoder.Default.Encode(s)))
|
|
|
|
|
);
|
2020-03-11 17:15:15 +08:00
|
|
|
|
|
2020-05-14 16:26:21 +08:00
|
|
|
|
services.TryAddScoped<IconService>();
|
2020-05-16 23:27:40 +08:00
|
|
|
|
services.TryAddScoped<InteropService>();
|
2020-05-19 20:08:49 +08:00
|
|
|
|
services.TryAddScoped<NotificationService>();
|
|
|
|
|
services.TryAddScoped<MessageService>();
|
2020-06-02 14:25:44 +08:00
|
|
|
|
services.TryAddScoped<ModalService>();
|
2020-05-10 22:43:58 +08:00
|
|
|
|
|
2019-12-11 17:17:58 +08:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-10 15:42:02 +08:00
|
|
|
|
}
|