aspnetcore/test/WebSites/ApiExplorerWebSite/ActionDescriptorChangeProvi...

29 lines
900 B
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.Threading;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Primitives;
namespace ApiExplorerWebSite
{
public class ActionDescriptorChangeProvider : IActionDescriptorChangeProvider
{
private ActionDescriptorChangeProvider()
{
}
public static ActionDescriptorChangeProvider Instance { get; } = new ActionDescriptorChangeProvider();
public CancellationTokenSource TokenSource { get; private set; }
public bool HasChanged { get; set; }
public IChangeToken GetChangeToken()
{
TokenSource = new CancellationTokenSource();
return new CancellationChangeToken(TokenSource.Token);
}
}
}