aspnetcore/src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpoint.cs

49 lines
1.4 KiB
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Patterns;
namespace Microsoft.AspNetCore.Routing.Matching
{
public sealed class MatcherEndpoint : Endpoint
{
internal static readonly Func<RequestDelegate, RequestDelegate> EmptyInvoker = (next) =>
{
return (context) => Task.CompletedTask;
};
public MatcherEndpoint(
Func<RequestDelegate, RequestDelegate> invoker,
RoutePattern routePattern,
int order,
EndpointMetadataCollection metadata,
string displayName)
: base(metadata, displayName)
{
if (invoker == null)
{
throw new ArgumentNullException(nameof(invoker));
}
if (routePattern == null)
{
throw new ArgumentNullException(nameof(routePattern));
}
Invoker = invoker;
RoutePattern = routePattern;
Order = order;
}
public Func<RequestDelegate, RequestDelegate> Invoker { get; }
public int Order { get; }
public RoutePattern RoutePattern { get; }
}
}