Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HelloAppBuilderExtensions.cs « HelloExtension « RoutingWebSite « testassets « test « Routing « Http « src - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a72705d7a459bb65504b0d60a5494ec73121b584 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Options;
using RoutingWebSite.HelloExtension;

namespace Microsoft.AspNetCore.Builder;

public static class HelloAppBuilderExtensions
{
    public static IApplicationBuilder UseHello(this IApplicationBuilder app, string greeter)
    {
        if (app == null)
        {
            throw new ArgumentNullException(nameof(app));
        }

        return app.UseMiddleware<HelloMiddleware>(Options.Create(new HelloOptions
        {
            Greeter = greeter
        }));
    }
}