// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Text;
namespace Microsoft.AspNet.Mvc.Logging
{
///
/// Represents the state of .
///
public class DefaultActionSelectorSelectAsyncValues
{
///
/// The name of the state.
///
public string Name
{
get
{
return "DefaultActionSelector.SelectAsync";
}
}
///
/// The list of actions that matched all their route constraints, if any.
///
public IList ActionsMatchingRouteConstraints { get; set; }
///
/// The list of actions that matched all their route and method constraints, if any.
///
public IList ActionsMatchingRouteAndMethodConstraints { get; set; }
///
/// The list of actions that matched all their route, method, and dynamic constraints, if any.
///
public IList ActionsMatchingRouteAndMethodAndDynamicConstraints { get; set; }
///
/// The actions that matched with at least one constraint.
///
public IList ActionsMatchingWithConstraints { get; set; }
///
/// The selected action.
///
public ActionDescriptor SelectedAction { get; set; }
///
/// A summary of the data for display.
///
public string Summary
{
get
{
var builder = new StringBuilder();
builder.AppendLine(Name);
builder.Append("\tActions matching route constraints: ");
StringBuilderHelpers.Append(builder, ActionsMatchingRouteConstraints, Formatter);
builder.AppendLine();
builder.Append("\tActions matching route and method constraints: ");
StringBuilderHelpers.Append(builder, ActionsMatchingRouteAndMethodConstraints, Formatter);
builder.AppendLine();
builder.Append("\tActions matching route, method, and dynamic constraints: ");
StringBuilderHelpers.Append(builder, ActionsMatchingRouteAndMethodAndDynamicConstraints, Formatter);
builder.AppendLine();
builder.Append("\tActions matching with at least one constraint: ");
StringBuilderHelpers.Append(builder, ActionsMatchingWithConstraints, Formatter);
builder.AppendLine();
builder.Append("\tSelected action: ");
builder.Append(Formatter(SelectedAction));
return builder.ToString();
}
}
///
public override string ToString()
{
return Summary;
}
private string Formatter(ActionDescriptor descriptor)
{
return descriptor.DisplayName;
}
}
}