// 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.Linq; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Routing { internal class BuilderEndpointDataSource : EndpointDataSource { private readonly EndpointDataSourceBuilder _builder; public BuilderEndpointDataSource(EndpointDataSourceBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } _builder = builder; } public override IChangeToken GetChangeToken() { return NullChangeToken.Singleton; } public override IReadOnlyList Endpoints => _builder.Endpoints.Select(b => b.Build()).ToArray(); } }