mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 01:11:52 +08:00
059491d749
* Replaced IdGeneratorHelper with DI service that can be replaced by user * removed license comments and unnecessary usings * check Id null before assigning autogenerated id * fix: unit test Co-authored-by: ElderJames <shunjiey@hotmail.com>
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
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<DomEventService>();
|
|
services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService<ILoggerFactory>(),
|
|
s => HtmlEncoder.Default.Encode(s)))
|
|
);
|
|
|
|
services.TryAddSingleton<IComponentIdGenerator, GuidComponentIdGenerator>();
|
|
services.TryAddScoped<IconService>();
|
|
services.TryAddScoped<InteropService>();
|
|
services.TryAddScoped<NotificationService>();
|
|
services.TryAddScoped<MessageService>();
|
|
services.TryAddScoped<ModalService>();
|
|
services.TryAddScoped<DrawerService>();
|
|
services.TryAddScoped<ConfirmService>();
|
|
|
|
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CurrentCulture;
|
|
|
|
return services;
|
|
}
|
|
}
|
|
}
|