ant-design-blazor/components/core/ServiceCollectionExtensions.cs
zxyao 042694b96f feat: add component message (#128)
* feat: add component message

* fix: then interface and demo bugs

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2020-05-19 20:08:49 +08:00

29 lines
977 B
C#

using System.Net.Http;
using System.Text.Encodings.Web;
using AntBlazor;
using AntBlazor.JsInterop;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddAntBlazor(this IServiceCollection services)
{
services.TryAddSingleton<HttpClient>();
services.TryAddScoped<DomEventService>();
services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService<ILoggerFactory>(),
s => HtmlEncoder.Default.Encode(s)))
);
services.TryAddScoped<IconService>();
services.TryAddScoped<InteropService>();
services.TryAddScoped<NotificationService>();
services.TryAddScoped<MessageService>();
return services;
}
}
}