ASP.NET Core 中间件获取依赖注入

2022年6月24日 1267点热度 1人点赞 0条评论
内容纲要
    public async static Task (this IApplicationBuilder app)
    {

app.ApplicationServices.GetRequiredService<ObjectAccessor<IApplicationBuilder>>()
    }
{
    public interface IApplicationBuilder
    {

        IFeatureCollection ServerFeatures { get; }

        IDictionary<string, object?> Properties { get; }

        RequestDelegate Build();

        IApplicationBuilder New();

        IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware);
    }

痴者工良

高级程序员劝退师

文章评论