Feature: Add DebuggerInfo to ApplicationModel

This commit is contained in:
Yishai Galatzer 2015-02-09 11:07:47 -08:00
parent 4ecbe8c709
commit 65839b678c
4 changed files with 20 additions and 0 deletions

View File

@ -2,11 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
namespace Microsoft.AspNet.Mvc.ApplicationModels namespace Microsoft.AspNet.Mvc.ApplicationModels
{ {
[DebuggerDisplay("Name={ActionName}({Methods()}), Type={Controller.ControllerType.Name}," +
" Route: {AttributeRouteModel?.Template}, Filters: {Filters.Count}")]
public class ActionModel public class ActionModel
{ {
public ActionModel([NotNull] MethodInfo actionMethod, public ActionModel([NotNull] MethodInfo actionMethod,
@ -91,5 +94,15 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
/// <see cref="ApplicationModel.Properties"/> and <see cref="ControllerModel.Properties"/>. /// <see cref="ApplicationModel.Properties"/> and <see cref="ControllerModel.Properties"/>.
/// </remarks> /// </remarks>
public IDictionary<object, object> Properties { get; } public IDictionary<object, object> Properties { get; }
private string Methods()
{
if (HttpMethods.Count == 0)
{
return "All";
}
return string.Join(", ", HttpMethods);
}
} }
} }

View File

@ -2,9 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.AspNet.Mvc.ApplicationModels namespace Microsoft.AspNet.Mvc.ApplicationModels
{ {
[DebuggerDisplay("ApplicationModel: Controllers: {Controllers.Count}, Filters: {Filters.Count}")]
public class ApplicationModel public class ApplicationModel
{ {
public ApplicationModel() public ApplicationModel()

View File

@ -2,11 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
namespace Microsoft.AspNet.Mvc.ApplicationModels namespace Microsoft.AspNet.Mvc.ApplicationModels
{ {
[DebuggerDisplay("Name={ControllerName}, Type={ControllerType.Name}," +
" Routes: {AttributeRoutes.Count}, Filters: {Filters.Count}")]
public class ControllerModel public class ControllerModel
{ {
public ControllerModel([NotNull] TypeInfo controllerType, public ControllerModel([NotNull] TypeInfo controllerType,

View File

@ -2,11 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection; using System.Reflection;
using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding;
namespace Microsoft.AspNet.Mvc.ApplicationModels namespace Microsoft.AspNet.Mvc.ApplicationModels
{ {
[DebuggerDisplay("ParameterModel: Name={ParameterName}")]
public class ParameterModel public class ParameterModel
{ {
public ParameterModel([NotNull] ParameterInfo parameterInfo, public ParameterModel([NotNull] ParameterInfo parameterInfo,