// 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.
namespace Microsoft.AspNetCore.Http
{
///
/// Respresents a logical endpoint in an application.
///
public class Endpoint
{
///
/// Creates a new instance of .
///
/// The delegate used to process requests for the endpoint.
///
/// The endpoint . May be null.
///
///
/// The informational display name of the endpoint. May be null.
///
public Endpoint(
RequestDelegate requestDelegate,
EndpointMetadataCollection metadata,
string displayName)
{
// All are allowed to be null
RequestDelegate = requestDelegate;
Metadata = metadata ?? EndpointMetadataCollection.Empty;
DisplayName = displayName;
}
///
/// Gets the informational display name of this endpoint.
///
public string DisplayName { get; }
///
/// Gets the collection of metadata associated with this endpoint.
///
public EndpointMetadataCollection Metadata { get; }
///
/// Gets the delegate used to process requests for the endpoint.
///
public RequestDelegate RequestDelegate { get; }
public override string ToString() => DisplayName ?? base.ToString();
}
}