// 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 Microsoft.Extensions.Primitives;
namespace Microsoft.AspNet.Mvc.Razor
{
///
/// Result of .
///
public struct RazorPageFactoryResult
{
///
/// Initializes a new instance of with the
/// specified .
///
/// One or more instances.
public RazorPageFactoryResult(IList expirationTokens)
{
if (expirationTokens == null)
{
throw new ArgumentNullException(nameof(expirationTokens));
}
ExpirationTokens = expirationTokens;
RazorPageFactory = null;
}
///
/// Initializes a new instance of with the
/// specified factory.
///
/// The factory.
/// One or more instances.
public RazorPageFactoryResult(
Func razorPageFactory,
IList expirationTokens)
{
if (razorPageFactory == null)
{
throw new ArgumentNullException(nameof(razorPageFactory));
}
if (expirationTokens == null)
{
throw new ArgumentNullException(nameof(expirationTokens));
}
RazorPageFactory = razorPageFactory;
ExpirationTokens = expirationTokens;
}
///
/// The factory.
///
/// This property is null when is false.
public Func RazorPageFactory { get; }
///
/// One or more s associated with this instance of
/// .
///
public IList ExpirationTokens { get; }
///
/// Gets a value that determines if the page was successfully located.
///
public bool Success => RazorPageFactory != null;
}
}