From 65839b678c0657519fa86649b65aa6842962842c Mon Sep 17 00:00:00 2001 From: Yishai Galatzer Date: Mon, 9 Feb 2015 11:07:47 -0800 Subject: [PATCH] Feature: Add DebuggerInfo to ApplicationModel --- .../ApplicationModels/ActionModel.cs | 13 +++++++++++++ .../ApplicationModels/ApplicationModel.cs | 2 ++ .../ApplicationModels/ControllerModel.cs | 3 +++ .../ApplicationModels/ParameterModel.cs | 2 ++ 4 files changed, 20 insertions(+) diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ActionModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ActionModel.cs index 311959c2de..547ad484b5 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ActionModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ActionModel.cs @@ -2,11 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; namespace Microsoft.AspNet.Mvc.ApplicationModels { + [DebuggerDisplay("Name={ActionName}({Methods()}), Type={Controller.ControllerType.Name}," + + " Route: {AttributeRouteModel?.Template}, Filters: {Filters.Count}")] public class ActionModel { public ActionModel([NotNull] MethodInfo actionMethod, @@ -91,5 +94,15 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels /// and . /// public IDictionary Properties { get; } + + private string Methods() + { + if (HttpMethods.Count == 0) + { + return "All"; + } + + return string.Join(", ", HttpMethods); + } } } diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ApplicationModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ApplicationModel.cs index b42266d258..9a6d8ca7f5 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ApplicationModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ApplicationModel.cs @@ -2,9 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; namespace Microsoft.AspNet.Mvc.ApplicationModels { + [DebuggerDisplay("ApplicationModel: Controllers: {Controllers.Count}, Filters: {Filters.Count}")] public class ApplicationModel { public ApplicationModel() diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ControllerModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ControllerModel.cs index ef2946204a..de2613246e 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ControllerModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ControllerModel.cs @@ -2,11 +2,14 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; namespace Microsoft.AspNet.Mvc.ApplicationModels { + [DebuggerDisplay("Name={ControllerName}, Type={ControllerType.Name}," + + " Routes: {AttributeRoutes.Count}, Filters: {Filters.Count}")] public class ControllerModel { public ControllerModel([NotNull] TypeInfo controllerType, diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ParameterModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ParameterModel.cs index 2f5cae9481..0dbcb17296 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ParameterModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/ParameterModel.cs @@ -2,11 +2,13 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; using System.Reflection; using Microsoft.AspNet.Mvc.ModelBinding; namespace Microsoft.AspNet.Mvc.ApplicationModels { + [DebuggerDisplay("ParameterModel: Name={ParameterName}")] public class ParameterModel { public ParameterModel([NotNull] ParameterInfo parameterInfo,