Blazor 服务器应用程序中的 IConfigurationSectionHandler

问题描述 投票:0回答:0

在 .NET Framework 4.8(Web 窗体)中,我们必须在 web.config 文件中配置节处理程序

<configuration>
    <configSections>
        <sectionGroup name="Log">
            <section name="logEventSinks" type="BlazorWeb.LogEventSinkSectionHandler, BlazorWeb" />
        </sectionGroup>
    </configSections>
    <Log>
        <logEventSinks>
        </logEventSinks>
    </Log>

执行此行时

ConfigurationManager.GetSection("Log/logEventSinks")
Create方法将被调用
IConfigurationSectionHandler
并传递节节点。

IConfigurationSectionHandler
object Create(object parent, object configContext, XmlNode section);

是否可以使用此库在 Blazor 服务器应用程序中执行相同的操作

Microsoft.Extensions.Configuration
? (或)

How to implement

IConfigurationSectionHandler
in Blazor server or is it possible to implement
IConfigurationSectionHandler
using
appsettings.json
.

请提出解决方案。

c# configuration blazor blazor-server-side appsettings
© www.soinside.com 2019 - 2024. All rights reserved.