diff --git a/Mvc.sln b/Mvc.sln index cf638fb0a9..ab9caeeb12 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.22130.0 +VisualStudioVersion = 14.0.22013.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}" EndProject @@ -81,14 +81,15 @@ EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "UrlHelperWebSite", "test\WebSites\UrlHelperWebSite\UrlHelperWebSite.kproj", "{A192E504-2881-41DC-90D1-B7F1DD1134E8}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApiExplorerWebSite", "test\WebSites\ApiExplorerWebSite\ApiExplorerWebSite.kproj", "{61061528-071E-424E-965A-07BCC2F02672}" -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "VersioningWebSite", "test\WebSites\VersioningWebSite\VersioningWebSite.kproj", "{C6304029-78C8-4604-99BE-2078DCA1DD36}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ReflectedModelWebSite", "test\WebSites\ReflectedModelWebSite\ReflectedModelWebSite.kproj", "{C2EF54F8-8886-4260-A322-44F76245F95D}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "VersioningWebSite", "test\WebSites\VersioningWebSite\VersioningWebSite.kproj", "{C6304029-78C8-4604-99BE-2078DCA1DD36}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FilesWebSite", "test\WebSites\FilesWebSite\FilesWebSite.kproj", "{0EF9860B-10D7-452F-B0F4-A405B88BEBB3}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorInstrumentationWebSite", "test\WebSites\RazorInstrumentationWebSite\RazorInstrumentationWebSite.kproj", "{2B2B9876-903C-4065-8D62-2EE832BBA106}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ApplicationModelWebSite", "test\WebSites\ApplicationModelWebSite\ApplicationModelWebSite.kproj", "{CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -419,16 +420,6 @@ Global {A192E504-2881-41DC-90D1-B7F1DD1134E8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {A192E504-2881-41DC-90D1-B7F1DD1134E8}.Release|Mixed Platforms.Build.0 = Release|Any CPU {A192E504-2881-41DC-90D1-B7F1DD1134E8}.Release|x86.ActiveCfg = Release|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|x86.ActiveCfg = Debug|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Any CPU.Build.0 = Release|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|x86.ActiveCfg = Release|Any CPU {61061528-071E-424E-965A-07BCC2F02672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {61061528-071E-424E-965A-07BCC2F02672}.Debug|Any CPU.Build.0 = Debug|Any CPU {61061528-071E-424E-965A-07BCC2F02672}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -449,16 +440,16 @@ Global {C6304029-78C8-4604-99BE-2078DCA1DD36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C6304029-78C8-4604-99BE-2078DCA1DD36}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C6304029-78C8-4604-99BE-2078DCA1DD36}.Release|x86.ActiveCfg = Release|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Debug|x86.ActiveCfg = Debug|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Release|Any CPU.Build.0 = Release|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C2EF54F8-8886-4260-A322-44F76245F95D}.Release|x86.ActiveCfg = Release|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Debug|x86.ActiveCfg = Debug|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Any CPU.Build.0 = Release|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3}.Release|x86.ActiveCfg = Release|Any CPU {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Any CPU.Build.0 = Debug|Any CPU {2B2B9876-903C-4065-8D62-2EE832BBA106}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -469,6 +460,16 @@ Global {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2B2B9876-903C-4065-8D62-2EE832BBA106}.Release|x86.ActiveCfg = Release|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Debug|x86.ActiveCfg = Debug|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Any CPU.Build.0 = Release|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -507,10 +508,10 @@ Global {1976AC4A-FEA4-4587-A158-D9F79736D2B6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {96107AC0-18E2-474D-BAB4-2FFF2185FBCD} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {A192E504-2881-41DC-90D1-B7F1DD1134E8} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {0EF9860B-10D7-452F-B0F4-A405B88BEBB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {61061528-071E-424E-965A-07BCC2F02672} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {C6304029-78C8-4604-99BE-2078DCA1DD36} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} - {C2EF54F8-8886-4260-A322-44F76245F95D} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} + {0EF9860B-10D7-452F-B0F4-A405B88BEBB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {2B2B9876-903C-4065-8D62-2EE832BBA106} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} + {CAE52CB7-0FAC-4B5B-8251-B0FF837DB657} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} EndGlobalSection EndGlobal diff --git a/samples/MvcSample.Web/AutoGenerateRouteNamesAttribute.cs b/samples/MvcSample.Web/AutoGenerateRouteNamesAttribute.cs index a9c114892c..51775083e3 100644 --- a/samples/MvcSample.Web/AutoGenerateRouteNamesAttribute.cs +++ b/samples/MvcSample.Web/AutoGenerateRouteNamesAttribute.cs @@ -2,20 +2,20 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; namespace MvcSample.Web { // Adds an auto-generated route-name to each action in the controller - public class AutoGenerateRouteNamesAttribute : Attribute, IReflectedControllerModelConvention + public class AutoGenerateRouteNamesAttribute : Attribute, IControllerModelConvention { - public void Apply(ReflectedControllerModel model) + public void Apply(ControllerModel model) { foreach (var action in model.Actions) { if (action.AttributeRouteModel == null) { - action.AttributeRouteModel = new ReflectedAttributeRouteModel(); + action.AttributeRouteModel = new AttributeRouteModel(); } if (action.AttributeRouteModel.Name == null) diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedActionModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ActionModel.cs similarity index 71% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedActionModel.cs rename to src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ActionModel.cs index 276fbf6e1a..2b6e629f32 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedActionModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ActionModel.cs @@ -7,11 +7,11 @@ using System.Reflection; using Microsoft.AspNet.Mvc.Description; using Microsoft.AspNet.Mvc.Routing; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedActionModel + public class ActionModel { - public ReflectedActionModel([NotNull] MethodInfo actionMethod) + public ActionModel([NotNull] MethodInfo actionMethod) { ActionMethod = actionMethod; @@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder ActionConstraints = new List(); Filters = new List(); HttpMethods = new List(); - Parameters = new List(); + Parameters = new List(); } public List ActionConstraints { get; private set; } @@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public List Attributes { get; private set; } - public ReflectedControllerModel Controller { get; set; } + public ControllerModel Controller { get; set; } public List Filters { get; private set; } @@ -38,20 +38,20 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public bool IsActionNameMatchRequired { get; set; } - public List Parameters { get; private set; } + public List Parameters { get; private set; } - public ReflectedAttributeRouteModel AttributeRouteModel { get; set; } + public AttributeRouteModel AttributeRouteModel { get; set; } /// /// If true, objects will be created for this action. If null - /// then the value of will be used. + /// then the value of will be used. /// public bool? ApiExplorerIsVisible { get; set; } /// /// The value for of objects created /// for actions defined by this controller. If null then the value of - /// will be used. + /// will be used. /// public string ApiExplorerGroupName { get; set; } } diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedAttributeRouteModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/AttributeRouteModel.cs similarity index 91% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedAttributeRouteModel.cs rename to src/Microsoft.AspNet.Mvc.Core/ApplicationModel/AttributeRouteModel.cs index ef9c091700..85dcb78c51 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedAttributeRouteModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/AttributeRouteModel.cs @@ -7,17 +7,17 @@ using System.Text; using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.Routing; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedAttributeRouteModel + public class AttributeRouteModel { - private static readonly ReflectedAttributeRouteModel _default = new ReflectedAttributeRouteModel(); + private static readonly AttributeRouteModel _default = new AttributeRouteModel(); - public ReflectedAttributeRouteModel() + public AttributeRouteModel() { } - public ReflectedAttributeRouteModel([NotNull] IRouteTemplateProvider templateProvider) + public AttributeRouteModel([NotNull] IRouteTemplateProvider templateProvider) { Attribute = templateProvider; Template = templateProvider.Template; @@ -43,17 +43,17 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder } /// - /// Combines two instances and returns - /// a new instance with the result. + /// Combines two instances and returns + /// a new instance with the result. /// - /// The left . - /// The right . - /// A new instance of that represents the - /// combination of the two instances or null if both + /// The left . + /// The right . + /// A new instance of that represents the + /// combination of the two instances or null if both /// parameters are null. - public static ReflectedAttributeRouteModel CombineReflectedAttributeRouteModel( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right) + public static AttributeRouteModel CombineAttributeRouteModel( + AttributeRouteModel left, + AttributeRouteModel right) { right = right ?? _default; @@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder return null; } - return new ReflectedAttributeRouteModel() + return new AttributeRouteModel() { Template = combinedTemplate, Order = right.Order ?? left.Order, @@ -81,8 +81,8 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder } private static string ChooseName( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right) + AttributeRouteModel left, + AttributeRouteModel right) { if (right.Name == null && string.IsNullOrEmpty(right.Template)) { diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedControllerModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ControllerModel.cs similarity index 74% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedControllerModel.cs rename to src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ControllerModel.cs index b967f12549..72fab6008f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedControllerModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ControllerModel.cs @@ -5,17 +5,17 @@ using System; using System.Collections.Generic; using System.Reflection; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedControllerModel + public class ControllerModel { - public ReflectedControllerModel([NotNull] TypeInfo controllerType) + public ControllerModel([NotNull] TypeInfo controllerType) { ControllerType = controllerType; - Actions = new List(); + Actions = new List(); Attributes = new List(); - AttributeRoutes = new List(); + AttributeRoutes = new List(); ActionConstraints = new List(); Filters = new List(); RouteConstraints = new List(); @@ -23,9 +23,9 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public List ActionConstraints { get; private set; } - public List Actions { get; private set; } + public List Actions { get; private set; } - public ReflectedApplicationModel Application { get; set; } + public GlobalModel Application { get; set; } public List Attributes { get; private set; } @@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public List RouteConstraints { get; private set; } - public List AttributeRoutes { get; private set; } + public List AttributeRoutes { get; private set; } /// /// If true, objects will be created for actions defined by diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedApplicationModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/GlobalModel.cs similarity index 55% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedApplicationModel.cs rename to src/Microsoft.AspNet.Mvc.Core/ApplicationModel/GlobalModel.cs index faf8d0c513..69ff21f3b2 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedApplicationModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/GlobalModel.cs @@ -3,17 +3,17 @@ using System.Collections.Generic; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedApplicationModel + public class GlobalModel { - public ReflectedApplicationModel() + public GlobalModel() { - Controllers = new List(); + Controllers = new List(); Filters = new List(); } - public List Controllers { get; private set; } + public List Controllers { get; private set; } public List Filters { get; private set; } } diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IActionModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IActionModelConvention.cs new file mode 100644 index 0000000000..665918ce2e --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IActionModelConvention.cs @@ -0,0 +1,25 @@ +// 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. + +namespace Microsoft.AspNet.Mvc.ApplicationModel +{ + /// + /// Allows customization of the of the . + /// + /// + /// To use this interface, create an class which implements the interface and + /// place it on an action method. + /// + /// customizations run after + /// customications and before + /// customizations. + /// + public interface IActionModelConvention + { + /// + /// Called to apply the convention to the . + /// + /// The . + void Apply([NotNull] ActionModel model); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IControllerModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IControllerModelConvention.cs new file mode 100644 index 0000000000..35260d15b0 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IControllerModelConvention.cs @@ -0,0 +1,25 @@ +// 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. + +namespace Microsoft.AspNet.Mvc.ApplicationModel +{ + /// + /// Allows customization of the of the . + /// + /// + /// To use this interface, create an class which implements the interface and + /// place it on a controller class. + /// + /// customizations run after + /// customizations and before + /// customizations. + /// + public interface IControllerModelConvention + { + /// + /// Called to apply the convention to the . + /// + /// The . + void Apply([NotNull] ControllerModel model); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IGlobalModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IGlobalModelConvention.cs new file mode 100644 index 0000000000..94ebc5fe44 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IGlobalModelConvention.cs @@ -0,0 +1,24 @@ +// 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. + +namespace Microsoft.AspNet.Mvc.ApplicationModel +{ + /// + /// Allows customization of the of the . + /// + /// + /// Implementaions of this interface can be registered in + /// to customize metadata about the application. + /// + /// run before other types of customizations to the + /// reflected model. + /// + public interface IGlobalModelConvention + { + /// + /// Called to apply the convention to the . + /// + /// The . + void Apply([NotNull] GlobalModel model); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IParameterModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IParameterModelConvention.cs new file mode 100644 index 0000000000..a17ec0537a --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/IParameterModelConvention.cs @@ -0,0 +1,24 @@ +// 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. + +namespace Microsoft.AspNet.Mvc.ApplicationModel +{ + /// + /// Allows customization of the of the . + /// + /// + /// To use this interface, create an class which implements the interface and + /// place it on an action method parameter. + /// + /// customizations run after + /// customizations. + /// + public interface IParameterModelConvention + { + /// + /// Called to apply the convention to the . + /// + /// The . + void Apply([NotNull] ParameterModel model); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedParameterModel.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ParameterModel.cs similarity index 73% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedParameterModel.cs rename to src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ParameterModel.cs index 7f61de375d..a7a5344f03 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/ReflectedParameterModel.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModel/ParameterModel.cs @@ -4,18 +4,18 @@ using System.Collections.Generic; using System.Reflection; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedParameterModel + public class ParameterModel { - public ReflectedParameterModel(ParameterInfo parameterInfo) + public ParameterModel(ParameterInfo parameterInfo) { ParameterInfo = parameterInfo; Attributes = new List(); } - public ReflectedActionModel Action { get; set; } + public ActionModel Action { get; set; } public List Attributes { get; private set; } diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptor.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptor.cs similarity index 95% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptor.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptor.cs index ea7b162dbf..68ba852276 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptor.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptor.cs @@ -8,7 +8,7 @@ using System.Reflection; namespace Microsoft.AspNet.Mvc { [DebuggerDisplay("CA {DisplayName}(RC-{RouteConstraints.Count})")] - public class ReflectedActionDescriptor : ActionDescriptor + public class ControllerActionDescriptor : ActionDescriptor { public string ControllerName { diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs similarity index 89% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs index c95fc0d2e4..00387725bf 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionDescriptorProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs @@ -8,14 +8,14 @@ using System.Reflection; using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.Description; using Microsoft.AspNet.Mvc.Filters; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; using Microsoft.AspNet.Mvc.Routing; using Microsoft.AspNet.Routing; using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Mvc { - public class ReflectedActionDescriptorProvider : IActionDescriptorProvider + public class ControllerActionDescriptorProvider : IActionDescriptorProvider { /// /// Represents the default order associated with this provider for dependency injection @@ -30,9 +30,9 @@ namespace Microsoft.AspNet.Mvc private readonly IControllerAssemblyProvider _controllerAssemblyProvider; private readonly IActionDiscoveryConventions _conventions; private readonly IReadOnlyList _globalFilters; - private readonly IEnumerable _modelConventions; + private readonly IEnumerable _modelConventions; - public ReflectedActionDescriptorProvider(IControllerAssemblyProvider controllerAssemblyProvider, + public ControllerActionDescriptorProvider(IControllerAssemblyProvider controllerAssemblyProvider, IActionDiscoveryConventions conventions, IGlobalFilterProvider globalFilters, IOptionsAccessor optionsAccessor) @@ -54,16 +54,16 @@ namespace Microsoft.AspNet.Mvc callNext(); } - public IEnumerable GetDescriptors() + public IEnumerable GetDescriptors() { var model = BuildModel(); ApplyConventions(model); return Build(model); } - public ReflectedApplicationModel BuildModel() + public GlobalModel BuildModel() { - var applicationModel = new ReflectedApplicationModel(); + var applicationModel = new GlobalModel(); applicationModel.Filters.AddRange(_globalFilters); var assemblies = _controllerAssemblyProvider.CandidateAssemblies; @@ -100,11 +100,11 @@ namespace Microsoft.AspNet.Mvc return applicationModel; } - private ReflectedControllerModel CreateControllerModel( - ReflectedApplicationModel applicationModel, + private ControllerModel CreateControllerModel( + GlobalModel applicationModel, TypeInfo controllerType) { - var controllerModel = new ReflectedControllerModel(controllerType) + var controllerModel = new ControllerModel(controllerType) { Application = applicationModel, }; @@ -124,7 +124,7 @@ namespace Microsoft.AspNet.Mvc controllerModel.RouteConstraints.AddRange(attributes.OfType()); controllerModel.AttributeRoutes.AddRange( - attributes.OfType().Select(rtp => new ReflectedAttributeRouteModel(rtp))); + attributes.OfType().Select(rtp => new AttributeRouteModel(rtp))); var apiVisibility = attributes.OfType().FirstOrDefault(); if (apiVisibility != null) @@ -141,12 +141,12 @@ namespace Microsoft.AspNet.Mvc return controllerModel; } - private ReflectedActionModel CreateActionModel( - ReflectedControllerModel controllerModel, + private ActionModel CreateActionModel( + ControllerModel controllerModel, MethodInfo methodInfo, ActionInfo actionInfo) { - var actionModel = new ReflectedActionModel(methodInfo) + var actionModel = new ActionModel(methodInfo) { ActionName = actionInfo.ActionName, Controller = controllerModel, @@ -176,18 +176,18 @@ namespace Microsoft.AspNet.Mvc if (actionInfo.AttributeRoute != null) { - actionModel.AttributeRouteModel = new ReflectedAttributeRouteModel( + actionModel.AttributeRouteModel = new AttributeRouteModel( actionInfo.AttributeRoute); } return actionModel; } - private ReflectedParameterModel CreateParameterModel( - ReflectedActionModel actionModel, + private ParameterModel CreateParameterModel( + ActionModel actionModel, ParameterInfo parameterInfo) { - var parameterModel = new ReflectedParameterModel(parameterInfo) + var parameterModel = new ParameterModel(parameterInfo) { Action = actionModel, }; @@ -203,7 +203,7 @@ namespace Microsoft.AspNet.Mvc return parameterModel; } - public void ApplyConventions(ReflectedApplicationModel model) + public void ApplyConventions(GlobalModel model) { // Conventions are applied from the outside-in to allow for scenarios where an action overrides // a controller, etc. @@ -219,7 +219,7 @@ namespace Microsoft.AspNet.Mvc // while iterating it. var controllerConventions = controller.Attributes - .OfType() + .OfType() .ToArray(); foreach (var controllerConvention in controllerConventions) @@ -233,7 +233,7 @@ namespace Microsoft.AspNet.Mvc // while iterating it. var actionConventions = action.Attributes - .OfType() + .OfType() .ToArray(); foreach (var actionConvention in actionConventions) @@ -247,7 +247,7 @@ namespace Microsoft.AspNet.Mvc // while iterating it. var parameterConventions = parameter.Attributes - .OfType() + .OfType() .ToArray(); foreach (var parameterConvention in parameterConventions) @@ -259,9 +259,9 @@ namespace Microsoft.AspNet.Mvc } } - public List Build(ReflectedApplicationModel application) + public List Build(GlobalModel application) { - var actions = new List(); + var actions = new List(); var hasAttributeRoutes = false; var removalConstraints = new HashSet(StringComparer.OrdinalIgnoreCase); @@ -407,12 +407,12 @@ namespace Microsoft.AspNet.Mvc return actions; } - private static IList CreateActionDescriptors( - ReflectedApplicationModel application, - ReflectedControllerModel controller, - ReflectedActionModel action) + private static IList CreateActionDescriptors( + GlobalModel application, + ControllerModel controller, + ActionModel action) { - var actionDescriptors = new List(); + var actionDescriptors = new List(); // We check the action to see if the template allows combination behavior // (It doesn't start with / or ~/) so that in the case where we have multiple @@ -478,9 +478,9 @@ namespace Microsoft.AspNet.Mvc return actionDescriptors; } - private static ReflectedActionDescriptor CreateActionDescriptor( - ReflectedActionModel action, - ReflectedAttributeRouteModel controllerAttributeRoute) + private static ControllerActionDescriptor CreateActionDescriptor( + ActionModel action, + AttributeRouteModel controllerAttributeRoute) { var parameterDescriptors = new List(); foreach (var parameter in action.Parameters) @@ -493,7 +493,7 @@ namespace Microsoft.AspNet.Mvc action.AttributeRouteModel, controllerAttributeRoute); - var actionDescriptor = new ReflectedActionDescriptor() + var actionDescriptor = new ControllerActionDescriptor() { Name = action.ActionName, MethodInfo = action.ActionMethod, @@ -510,7 +510,7 @@ namespace Microsoft.AspNet.Mvc return actionDescriptor; } - private static ParameterDescriptor CreateParameterDescriptor(ReflectedParameterModel parameter) + private static ParameterDescriptor CreateParameterDescriptor(ParameterModel parameter) { var parameterDescriptor = new ParameterDescriptor() { @@ -535,9 +535,9 @@ namespace Microsoft.AspNet.Mvc } private static void AddApiExplorerInfo( - ReflectedActionDescriptor actionDescriptor, - ReflectedActionModel action, - ReflectedControllerModel controller) + ControllerActionDescriptor actionDescriptor, + ActionModel action, + ControllerModel controller) { var apiExplorerIsVisible = action.ApiExplorerIsVisible ?? controller.ApiExplorerIsVisible ?? false; if (apiExplorerIsVisible) @@ -552,7 +552,7 @@ namespace Microsoft.AspNet.Mvc } private static void AddActionFilters( - ReflectedActionDescriptor actionDescriptor, + ControllerActionDescriptor actionDescriptor, IEnumerable actionFilters, IEnumerable controllerFilters, IEnumerable globalFilters) @@ -566,10 +566,10 @@ namespace Microsoft.AspNet.Mvc } private static AttributeRouteInfo CreateAttributeRouteInfo( - ReflectedAttributeRouteModel action, - ReflectedAttributeRouteModel controller) + AttributeRouteModel action, + AttributeRouteModel controller) { - var combinedRoute = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel( + var combinedRoute = AttributeRouteModel.CombineAttributeRouteModel( controller, action); @@ -589,8 +589,8 @@ namespace Microsoft.AspNet.Mvc } private static void AddActionConstraints( - ReflectedActionDescriptor actionDescriptor, - ReflectedActionModel action, + ControllerActionDescriptor actionDescriptor, + ActionModel action, IEnumerable controllerConstraints) { var constraints = new List(); @@ -618,9 +618,9 @@ namespace Microsoft.AspNet.Mvc } public void AddRouteConstraints( - ReflectedActionDescriptor actionDescriptor, - ReflectedControllerModel controller, - ReflectedActionModel action) + ControllerActionDescriptor actionDescriptor, + ControllerModel controller, + ActionModel action) { actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint( "controller", @@ -641,7 +641,7 @@ namespace Microsoft.AspNet.Mvc } private static void AddControllerRouteConstraints( - ReflectedActionDescriptor actionDescriptor, + ControllerActionDescriptor actionDescriptor, IList routeconstraints, ISet removalConstraints) { @@ -682,7 +682,7 @@ namespace Microsoft.AspNet.Mvc rc => string.Equals(rc.RouteKey, routeKey, StringComparison.OrdinalIgnoreCase)); } - private static void ReplaceRouteConstraints(ReflectedActionDescriptor actionDescriptor) + private static void ReplaceRouteConstraints(ControllerActionDescriptor actionDescriptor) { var routeGroupValue = GetRouteGroupValue( actionDescriptor.AttributeRouteInfo.Order, @@ -697,12 +697,12 @@ namespace Microsoft.AspNet.Mvc } private static void ReplaceAttributeRouteTokens( - ReflectedActionDescriptor actionDescriptor, + ControllerActionDescriptor actionDescriptor, IList routeTemplateErrors) { try { - actionDescriptor.AttributeRouteInfo.Template = ReflectedAttributeRouteModel.ReplaceTokens( + actionDescriptor.AttributeRouteInfo.Template = AttributeRouteModel.ReplaceTokens( actionDescriptor.AttributeRouteInfo.Template, actionDescriptor.RouteValueDefaults); } @@ -717,7 +717,7 @@ namespace Microsoft.AspNet.Mvc } } - private static void AddConstraintsAsDefaultRouteValues(ReflectedActionDescriptor actionDescriptor) + private static void AddConstraintsAsDefaultRouteValues(ControllerActionDescriptor actionDescriptor) { foreach (var constraint in actionDescriptor.RouteConstraints) { @@ -732,7 +732,7 @@ namespace Microsoft.AspNet.Mvc } private static void AddRemovalConstraints( - ReflectedActionDescriptor actionDescriptor, + ControllerActionDescriptor actionDescriptor, ISet removalConstraints) { foreach (var key in removalConstraints) @@ -749,7 +749,7 @@ namespace Microsoft.AspNet.Mvc private static void AddActionToNamedGroup( IDictionary> actionsByRouteName, string routeName, - ReflectedActionDescriptor actionDescriptor) + ControllerActionDescriptor actionDescriptor) { IList namedActionGroup; @@ -765,7 +765,7 @@ namespace Microsoft.AspNet.Mvc } } - private static bool IsAttributeRoutedAction(ReflectedActionDescriptor actionDescriptor) + private static bool IsAttributeRoutedAction(ControllerActionDescriptor actionDescriptor) { return actionDescriptor.AttributeRouteInfo != null && actionDescriptor.AttributeRouteInfo.Template != null; @@ -829,8 +829,8 @@ namespace Microsoft.AspNet.Mvc } private void ValidateActionGroupConfiguration( - IDictionary>> methodMap, - ReflectedActionDescriptor actionDescriptor, + IDictionary>> methodMap, + ControllerActionDescriptor actionDescriptor, IDictionary routingConfigurationErrors) { string combinedErrorMessage = null; @@ -838,7 +838,7 @@ namespace Microsoft.AspNet.Mvc var hasAttributeRoutedActions = false; var hasConventionallyRoutedActions = false; - var invalidHttpMethodActions = new Dictionary>(); + var invalidHttpMethodActions = new Dictionary>(); var actionsForMethod = methodMap[actionDescriptor.MethodInfo]; foreach (var reflectedAction in actionsForMethod) @@ -895,8 +895,8 @@ namespace Microsoft.AspNet.Mvc } private static void ValidateActionHttpMethodProviders( - ReflectedActionModel reflectedAction, - IDictionary> invalidHttpMethodActions) + ActionModel reflectedAction, + IDictionary> invalidHttpMethodActions) { var invalidHttpMethodProviderAttributes = reflectedAction.Attributes .Where(attr => attr is IActionHttpMethodProvider && @@ -929,9 +929,9 @@ namespace Microsoft.AspNet.Mvc } private static string CreateInvalidActionHttpMethodProviderErrorMessage( - ReflectedActionDescriptor actionDescriptor, - IDictionary> invalidHttpMethodActions, - IDictionary> actionsForMethod) + ControllerActionDescriptor actionDescriptor, + IDictionary> invalidHttpMethodActions, + IDictionary> actionsForMethod) { var messagesForMethodInfo = new List(); foreach (var invalidAction in invalidHttpMethodActions) @@ -981,8 +981,8 @@ namespace Microsoft.AspNet.Mvc } private static string CreateMixedRoutedActionDescriptorsErrorMessage( - ReflectedActionDescriptor actionDescriptor, - IDictionary> actionsForMethod) + ControllerActionDescriptor actionDescriptor, + IDictionary> actionsForMethod) { // Text to show as the attribute route template for conventionally routed actions. var nullTemplate = Resources.AttributeRoute_NullTemplateRepresentation; @@ -1044,12 +1044,12 @@ namespace Microsoft.AspNet.Mvc // public ActionResult List(){ ... } // } private class MethodToActionMap : - Dictionary>> + Dictionary>> { - public void AddToMethodInfo(ReflectedActionModel action, - IList actionDescriptors) + public void AddToMethodInfo(ActionModel action, + IList actionDescriptors) { - IDictionary> actionsForMethod = null; + IDictionary> actionsForMethod = null; if (TryGetValue(action.ActionMethod, out actionsForMethod)) { actionsForMethod.Add(action, actionDescriptors); @@ -1057,7 +1057,7 @@ namespace Microsoft.AspNet.Mvc else { var reflectedActionMap = - new Dictionary>(); + new Dictionary>(); reflectedActionMap.Add(action, actionDescriptors); Add(action.ActionMethod, reflectedActionMap); } diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionExecutor.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionExecutor.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedActionExecutor.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionExecutor.cs index 7e377812d3..6a8da6a80d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionExecutor.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionExecutor.cs @@ -11,10 +11,10 @@ using Microsoft.AspNet.Mvc.Core; namespace Microsoft.AspNet.Mvc { - public static class ReflectedActionExecutor + public static class ControllerActionExecutor { private static readonly MethodInfo _convertOfTMethod = - typeof(ReflectedActionExecutor).GetRuntimeMethods().Single(methodInfo => methodInfo.Name == "Convert"); + typeof(ControllerActionExecutor).GetRuntimeMethods().Single(methodInfo => methodInfo.Name == "Convert"); // Method called via reflection. private static Task Convert(object taskAsObject) diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs similarity index 90% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs index 15479c4af5..5d77e53ff1 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvoker.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs @@ -10,17 +10,17 @@ using Microsoft.Framework.DependencyInjection; namespace Microsoft.AspNet.Mvc { - public class ReflectedActionInvoker : FilterActionInvoker + public class ControllerActionInvoker : FilterActionInvoker { - private readonly ReflectedActionDescriptor _descriptor; + private readonly ControllerActionDescriptor _descriptor; private readonly IControllerFactory _controllerFactory; private readonly IInputFormattersProvider _inputFormattersProvider; - public ReflectedActionInvoker([NotNull] ActionContext actionContext, + public ControllerActionInvoker([NotNull] ActionContext actionContext, [NotNull] IActionBindingContextProvider bindingContextProvider, [NotNull] INestedProviderManager filterProvider, [NotNull] IControllerFactory controllerFactory, - [NotNull] ReflectedActionDescriptor descriptor, + [NotNull] ControllerActionDescriptor descriptor, [NotNull] IInputFormattersProvider inputFormattersProvider, [NotNull] IBodyModelValidator modelValidator) : base(actionContext, bindingContextProvider, filterProvider, modelValidator) @@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Mvc { throw new ArgumentException( Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo", - typeof(ReflectedActionDescriptor)), + typeof(ControllerActionDescriptor)), "descriptor"); } } @@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Mvc protected override async Task InvokeActionAsync(ActionExecutingContext actionExecutingContext) { var actionMethodInfo = _descriptor.MethodInfo; - var actionReturnValue = await ReflectedActionExecutor.ExecuteAsync( + var actionReturnValue = await ControllerActionExecutor.ExecuteAsync( actionMethodInfo, ActionContext.Controller, actionExecutingContext.ActionArguments); diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvokerProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvokerProvider.cs similarity index 88% rename from src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvokerProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionInvokerProvider.cs index d5f2af771e..b93085ee27 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedActionInvokerProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvokerProvider.cs @@ -7,7 +7,7 @@ using Microsoft.Framework.DependencyInjection; namespace Microsoft.AspNet.Mvc { - public class ReflectedActionInvokerProvider : IActionInvokerProvider + public class ControllerActionInvokerProvider : IActionInvokerProvider { private readonly IControllerFactory _controllerFactory; private readonly IActionBindingContextProvider _bindingProvider; @@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Mvc private readonly INestedProviderManager _filterProvider; private readonly IBodyModelValidator _modelValidator; - public ReflectedActionInvokerProvider(IControllerFactory controllerFactory, + public ControllerActionInvokerProvider(IControllerFactory controllerFactory, IActionBindingContextProvider bindingProvider, IInputFormattersProvider inputFormattersProvider, INestedProviderManager filterProvider, @@ -35,11 +35,11 @@ namespace Microsoft.AspNet.Mvc public void Invoke(ActionInvokerProviderContext context, Action callNext) { - var actionDescriptor = context.ActionContext.ActionDescriptor as ReflectedActionDescriptor; + var actionDescriptor = context.ActionContext.ActionDescriptor as ControllerActionDescriptor; if (actionDescriptor != null) { - context.Result = new ReflectedActionInvoker( + context.Result = new ControllerActionInvoker( context.ActionContext, _bindingProvider, _filterProvider, diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs index d46eca03f5..8eb6c5f674 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs @@ -24,12 +24,12 @@ namespace Microsoft.AspNet.Mvc public object CreateController(ActionContext actionContext) { - var actionDescriptor = actionContext.ActionDescriptor as ReflectedActionDescriptor; + var actionDescriptor = actionContext.ActionDescriptor as ControllerActionDescriptor; if (actionDescriptor == null) { throw new ArgumentException( Resources.FormatDefaultControllerFactory_ActionDescriptorMustBeReflected( - typeof(ReflectedActionDescriptor)), + typeof(ControllerActionDescriptor)), "actionContext"); } diff --git a/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs b/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs index 5cf0c7baf3..e6ad2f7dc0 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc.Description { /// /// Implements a provider of for actions represented - /// by . + /// by . /// public class DefaultApiDescriptionProvider : INestedProvider { @@ -39,7 +39,7 @@ namespace Microsoft.AspNet.Mvc.Description /// public void Invoke(ApiDescriptionProviderContext context, Action callNext) { - foreach (var action in context.Actions.OfType()) + foreach (var action in context.Actions.OfType()) { var extensionData = action.GetProperty(); if (extensionData != null) @@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Mvc.Description } private ApiDescription CreateApiDescription( - ReflectedActionDescriptor action, + ControllerActionDescriptor action, string httpMethod, string groupName) { @@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Mvc.Description return apiDescription; } - private IEnumerable GetHttpMethods(ReflectedActionDescriptor action) + private IEnumerable GetHttpMethods(ControllerActionDescriptor action) { if (action.ActionConstraints != null && action.ActionConstraints.Count > 0) { @@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Mvc.Description } } - private string GetRelativePath(ReflectedActionDescriptor action) + private string GetRelativePath(ControllerActionDescriptor action) { // This is a placeholder for functionality which will correctly generate the relative path // stub of an action. See: #885 @@ -175,7 +175,7 @@ namespace Microsoft.AspNet.Mvc.Description } private IReadOnlyList GetResponseFormats( - ReflectedActionDescriptor action, + ControllerActionDescriptor action, IApiResponseMetadataProvider[] responseMetadataAttributes, Type declaredType, Type runtimeType) @@ -221,7 +221,7 @@ namespace Microsoft.AspNet.Mvc.Description return results; } - private Type GetDeclaredReturnType(ReflectedActionDescriptor action) + private Type GetDeclaredReturnType(ControllerActionDescriptor action) { var declaredReturnType = action.MethodInfo.ReturnType; if (declaredReturnType == typeof(void) || @@ -281,7 +281,7 @@ namespace Microsoft.AspNet.Mvc.Description return declaredReturnType; } - private IApiResponseMetadataProvider[] GetResponseMetadataAttributes(ReflectedActionDescriptor action) + private IApiResponseMetadataProvider[] GetResponseMetadataAttributes(ControllerActionDescriptor action) { if (action.FilterDescriptors == null) { diff --git a/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs b/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs index 45f0ac44a1..924c9f66da 100644 --- a/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs +++ b/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.OptionDescriptors; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; namespace Microsoft.AspNet.Mvc { @@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Mvc public MvcOptions() { - ApplicationModelConventions = new List(); + ApplicationModelConventions = new List(); ModelBinders = new List(); ViewEngines = new List(); ValueProviderFactories = new List(); @@ -113,6 +113,6 @@ namespace Microsoft.AspNet.Mvc /// public List ValueProviderFactories { get; private set; } - public List ApplicationModelConventions { get; private set; } + public List ApplicationModelConventions { get; private set; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedActionModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedActionModelConvention.cs deleted file mode 100644 index 301c2de24e..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedActionModelConvention.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder -{ - /// - /// Allows customization of the of the . - /// - /// - /// To use this interface, create an class which implements the interface and - /// place it on an action method. - /// - /// customizations run after - /// customications and before - /// customizations. - /// - public interface IReflectedActionModelConvention - { - /// - /// Called to apply the convention to the . - /// - /// The . - void Apply([NotNull] ReflectedActionModel model); - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedApplicationModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedApplicationModelConvention.cs deleted file mode 100644 index e218c03254..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedApplicationModelConvention.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder -{ - /// - /// Allows customization of the of the . - /// - /// - /// Implementaions of this interface can be registered in - /// to customize metadata about the application. - /// - /// run before other types of customizations to the - /// reflected model. - /// - public interface IReflectedApplicationModelConvention - { - /// - /// Called to apply the convention to the . - /// - /// The . - void Apply([NotNull] ReflectedApplicationModel model); - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedControllerModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedControllerModelConvention.cs deleted file mode 100644 index c85e4b7b31..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedControllerModelConvention.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder -{ - /// - /// Allows customization of the of the . - /// - /// - /// To use this interface, create an class which implements the interface and - /// place it on a controller class. - /// - /// customizations run after - /// customizations and before - /// customizations. - /// - public interface IReflectedControllerModelConvention - { - /// - /// Called to apply the convention to the . - /// - /// The . - void Apply([NotNull] ReflectedControllerModel model); - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedParameterModelConvention.cs b/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedParameterModelConvention.cs deleted file mode 100644 index 3ee0e3ef19..0000000000 --- a/src/Microsoft.AspNet.Mvc.Core/ReflectedModelBuilder/IReflectedParameterModelConvention.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder -{ - /// - /// Allows customization of the of the . - /// - /// - /// To use this interface, create an class which implements the interface and - /// place it on an action method parameter. - /// - /// customizations run after - /// customizations. - /// - public interface IReflectedParameterModelConvention - { - /// - /// Called to apply the convention to the . - /// - /// The . - void Apply([NotNull] ReflectedParameterModel model); - } -} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs b/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs index 680e59fbf4..cc68225114 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs @@ -86,7 +86,7 @@ namespace Microsoft.AspNet.Mvc { var component = CreateComponent(context); - var result = await ReflectedActionExecutor.ExecuteAsync(method, component, _args); + var result = await ControllerActionExecutor.ExecuteAsync(method, component, _args); return CoerceToViewComponentResult(result); } diff --git a/src/Microsoft.AspNet.Mvc/MvcServices.cs b/src/Microsoft.AspNet.Mvc/MvcServices.cs index 880fad09a6..bc55158dde 100644 --- a/src/Microsoft.AspNet.Mvc/MvcServices.cs +++ b/src/Microsoft.AspNet.Mvc/MvcServices.cs @@ -72,9 +72,9 @@ namespace Microsoft.AspNet.Mvc yield return describe.Singleton(); yield return describe.Transient, - ReflectedActionDescriptorProvider>(); + ControllerActionDescriptorProvider>(); yield return describe.Transient, - ReflectedActionInvokerProvider>(); + ControllerActionInvokerProvider>(); yield return describe.Singleton(); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ActionAttributeTests.cs index 7e0163ff00..d9822ca681 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionAttributeTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ActionAttributeTests.cs @@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Mvc // Act var result = actionDescriptorProvider.GetDescriptors() - .Select(x => x as ReflectedActionDescriptor) + .Select(x => x as ControllerActionDescriptor) .FirstOrDefault( x=> x.ControllerName == "NonAction" && x.Name == actionName); @@ -193,7 +193,7 @@ namespace Microsoft.AspNet.Mvc return await defaultActionSelector.SelectAsync(context); } - private ReflectedActionDescriptorProvider GetActionDescriptorProvider( + private ControllerActionDescriptorProvider GetActionDescriptorProvider( IActionDiscoveryConventions actionDiscoveryConventions = null) { var controllerAssemblyProvider = new StaticControllerAssemblyProvider(); @@ -207,7 +207,7 @@ namespace Microsoft.AspNet.Mvc actionDiscoveryConventions = new StaticActionDiscoveryConventions(controllerTypes.ToArray()); } - return new ReflectedActionDescriptorProvider( + return new ControllerActionDescriptorProvider( controllerAssemblyProvider, actionDiscoveryConventions, new TestGlobalFilterProvider(), diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionExecutorTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ActionExecutorTests.cs index 03def99639..f1d62841fb 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionExecutorTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ActionExecutorTests.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test public async Task AsyncAction_WithVoidReturnType() { var methodWithVoidReturnType = new MethodWithVoidReturnType(TestController.VoidAction); - var result = await ReflectedActionExecutor.ExecuteAsync( + var result = await ControllerActionExecutor.ExecuteAsync( methodWithVoidReturnType.GetMethodInfo(), null, (IDictionary)null); @@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var actionParameters = new Dictionary { { "i", inputParam1 }, { "s", inputParam2 } }; var methodWithTaskReturnType = new MethodWithTaskReturnType(_controller.TaskAction); - var result = await ReflectedActionExecutor.ExecuteAsync( + var result = await ControllerActionExecutor.ExecuteAsync( methodWithTaskReturnType.GetMethodInfo(), _controller, actionParameters); @@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var actionParameters = new Dictionary { { "i", inputParam1 }, { "s", inputParam2 } }; var methodWithTaskOfIntReturnType = new MethodWithTaskOfIntReturnType(_controller.TaskValueTypeAction); - var result = await ReflectedActionExecutor.ExecuteAsync( + var result = await ControllerActionExecutor.ExecuteAsync( methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters); @@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var actionParameters = new Dictionary { { "i", inputParam1 }, { "s", inputParam2 } }; var methodWithTaskOfTaskOfIntReturnType = new MethodWithTaskOfTaskOfIntReturnType(_controller.TaskOfTaskAction); - var result = await (Task)(await ReflectedActionExecutor.ExecuteAsync( + var result = await (Task)(await ControllerActionExecutor.ExecuteAsync( methodWithTaskOfTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters)); @@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test // Act and Assert await Assert.ThrowsAsync( - () => ReflectedActionExecutor.ExecuteAsync(methodWithTaskOfIntReturnType.GetMethodInfo(), + () => ControllerActionExecutor.ExecuteAsync(methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters)); } @@ -112,7 +112,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var methodWithTaskOfIntReturnType = new MethodWithTaskOfIntReturnType(_controller.TaskActionWithExceptionWithoutAsync); await Assert.ThrowsAsync( - () => ReflectedActionExecutor.ExecuteAsync(methodWithTaskOfIntReturnType.GetMethodInfo(), + () => ControllerActionExecutor.ExecuteAsync(methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters)); } @@ -127,7 +127,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var methodWithTaskOfIntReturnType = new MethodWithTaskOfIntReturnType(_controller.TaskActionThrowAfterAwait); await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters), @@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test { string inputString = "hello"; var syncMethod = new SyncMethod(_controller.Echo); - var result = await ReflectedActionExecutor.ExecuteAsync( + var result = await ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary() { { "input", inputString } }); @@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test string inputString = "hello"; var syncMethod = new SyncMethod(_controller.EchoWithException); await Assert.ThrowsAsync( - () => ReflectedActionExecutor.ExecuteAsync( + () => ControllerActionExecutor.ExecuteAsync( syncMethod.GetMethodInfo(), _controller, new Dictionary() { { "input", inputString } })); @@ -174,7 +174,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test typeof(TestController)); await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( methodWithCutomTaskReturnType.GetMethodInfo(), _controller, actionParameters), @@ -196,7 +196,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( methodWithCutomTaskOfTReturnType.GetMethodInfo(), _controller, actionParameters), @@ -213,7 +213,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var methodWithUnwrappedTask = new MethodWithTaskReturnType(_controller.UnwrappedTask); await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( methodWithUnwrappedTask.GetMethodInfo(), _controller, actionParameters), @@ -238,7 +238,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test typeof(TestController)); await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( dynamicTaskMethod.GetMethodInfo(), _controller, actionParameters), @@ -255,7 +255,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var actionParameters = new Dictionary { { "s", inputParam2 }, { "i", inputParam1 } }; var methodWithTaskOfIntReturnType = new MethodWithTaskOfIntReturnType(_controller.TaskValueTypeAction); - var result = await ReflectedActionExecutor.ExecuteAsync( + var result = await ControllerActionExecutor.ExecuteAsync( methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters); @@ -280,7 +280,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test // If it is an unrecognized derived type we throw an InvalidOperationException. await AssertThrowsAsync( async () => - await ReflectedActionExecutor.ExecuteAsync( + await ControllerActionExecutor.ExecuteAsync( methodWithTaskOfIntReturnType.GetMethodInfo(), _controller, actionParameters), diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedModelBuilder/ReflectedAttributeRouteModelTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/AttributeRouteModelTests.cs similarity index 87% rename from test/Microsoft.AspNet.Mvc.Core.Test/ReflectedModelBuilder/ReflectedAttributeRouteModelTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/AttributeRouteModelTests.cs index 73576c6ec9..043cb20aac 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedModelBuilder/ReflectedAttributeRouteModelTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/AttributeRouteModelTests.cs @@ -6,9 +6,9 @@ using System; using System.Collections.Generic; using Xunit; -namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder +namespace Microsoft.AspNet.Mvc.ApplicationModel { - public class ReflectedAttributeRouteModelTests + public class AttributeRouteModelTests { [Theory] [InlineData(null, null, null)] @@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public void Combine_EmptyTemplates(string left, string right, string expected) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineTemplates(left, right); + var combined = AttributeRouteModel.CombineTemplates(left, right); // Assert Assert.Equal(expected, combined); @@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public void Combine_OneTemplateHasValue(string left, string right, string expected) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineTemplates(left, right); + var combined = AttributeRouteModel.CombineTemplates(left, right); // Assert Assert.Equal(expected, combined); @@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public void Combine_BothTemplatesHasValue(string left, string right, string expected) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineTemplates(left, right); + var combined = AttributeRouteModel.CombineTemplates(left, right); // Assert Assert.Equal(expected, combined); @@ -95,7 +95,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder public void Combine_InvalidTemplates(string left, string right, string expected) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineTemplates(left, right); + var combined = AttributeRouteModel.CombineTemplates(left, right); // Assert Assert.Equal(expected, combined); @@ -113,7 +113,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder } // Act - var result = ReflectedAttributeRouteModel.ReplaceTokens(template, valuesDictionary); + var result = AttributeRouteModel.ReplaceTokens(template, valuesDictionary); // Assert Assert.Equal(expected, result); @@ -137,7 +137,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder // Act var ex = Assert.Throws( - () => { ReflectedAttributeRouteModel.ReplaceTokens(template, valuesDictionary); }); + () => { AttributeRouteModel.ReplaceTokens(template, valuesDictionary); }); // Assert Assert.Equal(expected, ex.Message); @@ -162,7 +162,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder // Act var ex = Assert.Throws( - () => { ReflectedAttributeRouteModel.ReplaceTokens(template, values); }); + () => { AttributeRouteModel.ReplaceTokens(template, values); }); // Assert Assert.Equal(expected, ex.Message); @@ -171,12 +171,12 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder [Theory] [MemberData(nameof(CombineOrdersTestData))] public void Combine_Orders( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right, + AttributeRouteModel left, + AttributeRouteModel right, int? expected) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel(left, right); + var combined = AttributeRouteModel.CombineAttributeRouteModel(left, right); // Assert Assert.NotNull(combined); @@ -186,12 +186,12 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder [Theory] [MemberData(nameof(ValidReflectedAttributeRouteModelsTestData))] public void Combine_ValidReflectedAttributeRouteModels( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right, - ReflectedAttributeRouteModel expectedResult) + AttributeRouteModel left, + AttributeRouteModel right, + AttributeRouteModel expectedResult) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel(left, right); + var combined = AttributeRouteModel.CombineAttributeRouteModel(left, right); // Assert Assert.NotNull(combined); @@ -201,11 +201,11 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder [Theory] [MemberData(nameof(NullOrNullTemplateReflectedAttributeRouteModelTestData))] public void Combine_NullOrNullTemplateReflectedAttributeRouteModels( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right) + AttributeRouteModel left, + AttributeRouteModel right) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel(left, right); + var combined = AttributeRouteModel.CombineAttributeRouteModel(left, right); // Assert Assert.Null(combined); @@ -214,14 +214,14 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder [Theory] [MemberData(nameof(RightOverridesReflectedAttributeRouteModelTestData))] public void Combine_RightOverridesReflectedAttributeRouteModel( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right) + AttributeRouteModel left, + AttributeRouteModel right) { // Arrange - var expectedTemplate = ReflectedAttributeRouteModel.CombineTemplates(null, right.Template); + var expectedTemplate = AttributeRouteModel.CombineTemplates(null, right.Template); // Act - var combined = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel(left, right); + var combined = AttributeRouteModel.CombineAttributeRouteModel(left, right); // Assert Assert.NotNull(combined); @@ -232,12 +232,12 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder [Theory] [MemberData(nameof(CombineNamesTestData))] public void Combine_Names( - ReflectedAttributeRouteModel left, - ReflectedAttributeRouteModel right, + AttributeRouteModel left, + AttributeRouteModel right, string expectedName) { // Arrange & Act - var combined = ReflectedAttributeRouteModel.CombineReflectedAttributeRouteModel(left, right); + var combined = AttributeRouteModel.CombineAttributeRouteModel(left, right); // Assert Assert.NotNull(combined); @@ -249,7 +249,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder get { // AttributeRoute on the controller, attribute route on the action, expected name. - var data = new TheoryData(); + var data = new TheoryData(); // Combined name is null if no name is provided. data.Add(Create(template: "/", order: null, name: null), null, null); @@ -302,7 +302,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder get { // AttributeRoute on the controller, attribute route on the action, expected order. - var data = new TheoryData(); + var data = new TheoryData(); data.Add(Create("", order: 1), Create("", order: 2), 2); data.Add(Create("", order: 1), Create("", order: null), 1); @@ -331,7 +331,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder get { // AttributeRoute on the controller, attribute route on the action. - var data = new TheoryData(); + var data = new TheoryData(); var leftModel = Create("Home", order: 3); data.Add(leftModel, Create("/")); @@ -350,7 +350,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder get { // AttributeRoute on the controller, attribute route on the action. - var data = new TheoryData(); + var data = new TheoryData(); data.Add(null, null); data.Add(null, Create(null)); @@ -366,7 +366,7 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder get { // AttributeRoute on the controller, attribute route on the action, expected combined attribute route. - var data = new TheoryData(); + var data = new TheoryData(); data.Add(null, Create("Index"), Create("Index")); data.Add(Create(null), Create("Index"), Create("Index")); data.Add(Create("Home"), null, Create("Home")); @@ -524,9 +524,9 @@ namespace Microsoft.AspNet.Mvc.ReflectedModelBuilder } } - private static ReflectedAttributeRouteModel Create(string template, int? order = null, string name = null) + private static AttributeRouteModel Create(string template, int? order = null, string name = null) { - return new ReflectedAttributeRouteModel + return new AttributeRouteModel { Template = template, Order = order, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionDescriptorProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs similarity index 94% rename from test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionDescriptorProviderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs index 1e64f1bc9f..3686f7e1f5 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionDescriptorProviderTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs @@ -7,14 +7,14 @@ using System.Linq; using System.Reflection; using Microsoft.AspNet.Mvc.Description; using Microsoft.AspNet.Mvc.Routing; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; using Microsoft.Framework.OptionsModel; using Moq; using Xunit; namespace Microsoft.AspNet.Mvc.Test { - public class ReflectedActionDescriptorProviderTests + public class ControllerActionDescriptorProviderTests { [Fact] public void GetDescriptors_GetsDescriptorsOnlyForValidActions() @@ -85,18 +85,18 @@ namespace Microsoft.AspNet.Mvc.Test "The following errors occurred with attribute routing information:" + Environment.NewLine + Environment.NewLine + "Error 1:" + Environment.NewLine + - "A method 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "A method 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeRoutedHttpMethodController.PutOrPatch'" + " that defines attribute routed actions must not have attributes that implement " + "'Microsoft.AspNet.Mvc.IActionHttpMethodProvider' and do not implement " + "'Microsoft.AspNet.Mvc.Routing.IRouteTemplateProvider':" + Environment.NewLine + - "Action 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeRoutedHttpMethodController.PutOrPatch' with route template 'Products' has " + - "'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + + "'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + " invalid 'Microsoft.AspNet.Mvc.IActionHttpMethodProvider' attributes." + Environment.NewLine + - "Action 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeRoutedHttpMethodController.PutOrPatch' with route template 'Items' has " + - "'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + + "'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + " invalid 'Microsoft.AspNet.Mvc.IActionHttpMethodProvider' attributes."; var provider = GetProvider( @@ -466,7 +466,7 @@ namespace Microsoft.AspNet.Mvc.Test } [Fact] - public void BuildModel_CreatesReflectedControllerModels_ForAllControllers() + public void BuildModel_CreatesControllerModels_ForAllControllers() { // Arrange var provider = GetProvider( @@ -502,7 +502,7 @@ namespace Microsoft.AspNet.Mvc.Test } [Fact] - public void BuildModel_CreatesReflectedActionDescriptors_ForValidActions() + public void BuildModel_CreatesControllerActionDescriptors_ForValidActions() { // Arrange var provider = GetProvider( @@ -539,8 +539,8 @@ namespace Microsoft.AspNet.Mvc.Test Assert.Equal( new[] { - "Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+PersonController.GetPerson", - "Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+PersonController.ListPeople", + "Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+PersonController.GetPerson", + "Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+PersonController.ListPeople", }, displayNames); } @@ -587,13 +587,13 @@ namespace Microsoft.AspNet.Mvc.Test "The following errors occurred with attribute routing information:" + Environment.NewLine + Environment.NewLine + "Error 1:" + Environment.NewLine + - "For action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "For action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "MultipleErrorsController.Unknown'" + Environment.NewLine + "Error: While processing template 'stub/[action]/[unknown]', a replacement value for the token 'unknown' " + "could not be found. Available tokens: 'controller, action'." + Environment.NewLine + Environment.NewLine + "Error 2:" + Environment.NewLine + - "For action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "For action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "MultipleErrorsController.Invalid'" + Environment.NewLine + "Error: The route template '[invalid/syntax' has invalid syntax. A replacement token is not closed."; @@ -786,22 +786,22 @@ namespace Microsoft.AspNet.Mvc.Test "The following errors occurred with attribute routing information:" + Environment.NewLine + Environment.NewLine + "Error 1:" + Environment.NewLine + - "A method 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "A method 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method'" + " must not define attribute routed actions and non attribute routed actions at the same time:" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method' - Template: 'AttributeRouted'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method' - Template: '(none)'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method' - Template: '(none)'" + Environment.NewLine + - "A method 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "A method 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method' that defines attribute routed actions must not" + " have attributes that implement 'Microsoft.AspNet.Mvc.IActionHttpMethodProvider' and do not implement" + " 'Microsoft.AspNet.Mvc.Routing.IRouteTemplateProvider':" + Environment.NewLine + - "Action 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "AttributeAndNonAttributeRoutedActionsOnSameMethodController.Method' with route template 'AttributeRouted' has " + - "'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + + "'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+CustomHttpMethodConstraintAttribute'" + " invalid 'Microsoft.AspNet.Mvc.IActionHttpMethodProvider' attributes."; var provider = GetProvider( @@ -847,37 +847,37 @@ namespace Microsoft.AspNet.Mvc.Test "Error 1:" + Environment.NewLine + "Attribute routes with the same name 'Products' must have the same template:" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.Get' - Template: 'Products'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.Get' - Template: 'Products/{id}'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.Put' - Template: 'Products/{id}'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.Post' - Template: 'Products'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.Delete' - Template: 'Products/{id}'" + Environment.NewLine + Environment.NewLine + "Error 2:" + Environment.NewLine + "Attribute routes with the same name 'Items' must have the same template:" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.GetItems' - Template: 'Items/{id}'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.PostItems' - Template: 'Items'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.PutItems' - Template: 'Items/{id}'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.DeleteItems' - Template: 'Items/{id}'" + Environment.NewLine + - "Action: 'Microsoft.AspNet.Mvc.Test.ReflectedActionDescriptorProviderTests+" + + "Action: 'Microsoft.AspNet.Mvc.Test.ControllerActionDescriptorProviderTests+" + "SameNameDifferentTemplatesController.PatchItems' - Template: 'Items'"; // Act @@ -1142,24 +1142,24 @@ namespace Microsoft.AspNet.Mvc.Test // Arrange var sequence = 0; - var applicationConvention = new Mock(); + var applicationConvention = new Mock(); applicationConvention - .Setup(c => c.Apply(It.IsAny())) + .Setup(c => c.Apply(It.IsAny())) .Callback(() => { Assert.Equal(0, sequence++); }); - var controllerConvention = new Mock(); + var controllerConvention = new Mock(); controllerConvention - .Setup(c => c.Apply(It.IsAny())) + .Setup(c => c.Apply(It.IsAny())) .Callback(() => { Assert.Equal(1, sequence++); }); - var actionConvention = new Mock(); + var actionConvention = new Mock(); actionConvention - .Setup(c => c.Apply(It.IsAny())) + .Setup(c => c.Apply(It.IsAny())) .Callback(() => { Assert.Equal(2, sequence++); }); - var parameterConvention = new Mock(); + var parameterConvention = new Mock(); parameterConvention - .Setup(c => c.Apply(It.IsAny())) + .Setup(c => c.Apply(It.IsAny())) .Callback(() => { Assert.Equal(3, sequence++); }); var options = new MockMvcOptionsAccessor(); @@ -1328,7 +1328,7 @@ namespace Microsoft.AspNet.Mvc.Test Assert.Single(action.ActionConstraints, a => a is ConstraintAttribute); } - private ReflectedActionDescriptorProvider GetProvider( + private ControllerActionDescriptorProvider GetProvider( TypeInfo controllerTypeInfo, IEnumerable filters = null) { @@ -1339,7 +1339,7 @@ namespace Microsoft.AspNet.Mvc.Test .SetupGet(ap => ap.CandidateAssemblies) .Returns(new Assembly[] { controllerTypeInfo.Assembly }); - var provider = new ReflectedActionDescriptorProvider( + var provider = new ControllerActionDescriptorProvider( assemblyProvider.Object, conventions, new TestGlobalFilterProvider(filters), @@ -1348,7 +1348,7 @@ namespace Microsoft.AspNet.Mvc.Test return provider; } - private ReflectedActionDescriptorProvider GetProvider( + private ControllerActionDescriptorProvider GetProvider( params TypeInfo[] controllerTypeInfo) { var conventions = new StaticActionDiscoveryConventions(controllerTypeInfo); @@ -1358,7 +1358,7 @@ namespace Microsoft.AspNet.Mvc.Test .SetupGet(ap => ap.CandidateAssemblies) .Returns(new Assembly[] { controllerTypeInfo.First().Assembly }); - var provider = new ReflectedActionDescriptorProvider( + var provider = new ControllerActionDescriptorProvider( assemblyProvider.Object, conventions, new TestGlobalFilterProvider(), @@ -1367,7 +1367,7 @@ namespace Microsoft.AspNet.Mvc.Test return provider; } - private ReflectedActionDescriptorProvider GetProvider( + private ControllerActionDescriptorProvider GetProvider( TypeInfo type, IOptionsAccessor options) { @@ -1378,7 +1378,7 @@ namespace Microsoft.AspNet.Mvc.Test .SetupGet(ap => ap.CandidateAssemblies) .Returns(new Assembly[] { type.Assembly }); - return new ReflectedActionDescriptorProvider( + return new ControllerActionDescriptorProvider( assemblyProvider.Object, conventions, new TestGlobalFilterProvider(), @@ -1394,7 +1394,7 @@ namespace Microsoft.AspNet.Mvc.Test .SetupGet(ap => ap.CandidateAssemblies) .Returns(controllerTypeInfos.Select(cti => cti.Assembly).Distinct()); - var provider = new ReflectedActionDescriptorProvider( + var provider = new ControllerActionDescriptorProvider( assemblyProvider.Object, conventions, new TestGlobalFilterProvider(), diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionInvokerTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs similarity index 97% rename from test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionInvokerTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs index 8ffe2a318d..2e015521b6 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ReflectedActionInvokerTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs @@ -18,7 +18,7 @@ using Xunit; namespace Microsoft.AspNet.Mvc { - public class ReflectedActionInvokerTest + public class ControllerActionInvokerTest { // Intentionally choosing an uncommon exception type. private readonly Exception _actionException = new TimeZoneNotFoundException(); @@ -1212,7 +1212,7 @@ namespace Microsoft.AspNet.Mvc var mockActionResult = new Mock(); // Assert - var result = ReflectedActionInvoker.CreateActionResult( + var result = ControllerActionInvoker.CreateActionResult( mockActionResult.Object.GetType(), mockActionResult.Object); // Act @@ -1225,7 +1225,7 @@ namespace Microsoft.AspNet.Mvc { // Arrange, Act & Assert ExceptionAssert.Throws( - () => ReflectedActionInvoker.CreateActionResult(typeof(IActionResult), null), + () => ControllerActionInvoker.CreateActionResult(typeof(IActionResult), null), "Cannot return null from an action method with a return type of '" + typeof(IActionResult) + "'."); @@ -1237,7 +1237,7 @@ namespace Microsoft.AspNet.Mvc public void CreateActionResult_Types_ReturnsObjectResultForTaskAndVoidReturnTypes(Type type) { // Arrange & Act - var result = ReflectedActionInvoker.CreateActionResult(type, null); + var result = ControllerActionInvoker.CreateActionResult(type, null); // Assert var objectResult = Assert.IsType(result); @@ -1269,21 +1269,21 @@ namespace Microsoft.AspNet.Mvc public void CreateActionResult_ReturnsObjectContentResult(Type type, object input) { // Arrange & Act - var actualResult = ReflectedActionInvoker.CreateActionResult(type, input); + var actualResult = ControllerActionInvoker.CreateActionResult(type, input); // Assert var contentResult = Assert.IsType(actualResult); Assert.Same(input, contentResult.Value); } - private TestReflectedActionInvoker CreateInvoker(IFilter filter, bool actionThrows = false) + private TestControllerActionInvoker CreateInvoker(IFilter filter, bool actionThrows = false) { return CreateInvoker(new[] { filter }, actionThrows); } - private TestReflectedActionInvoker CreateInvoker(IFilter[] filters, bool actionThrows = false) + private TestControllerActionInvoker CreateInvoker(IFilter[] filters, bool actionThrows = false) { - var actionDescriptor = new ReflectedActionDescriptor() + var actionDescriptor = new ControllerActionDescriptor() { FilterDescriptors = new List(), Parameters = new List(), @@ -1291,11 +1291,11 @@ namespace Microsoft.AspNet.Mvc if (actionThrows) { - actionDescriptor.MethodInfo = typeof(ReflectedActionInvokerTest).GetMethod("ThrowingActionMethod"); + actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest).GetMethod("ThrowingActionMethod"); } else { - actionDescriptor.MethodInfo = typeof(ReflectedActionInvokerTest).GetMethod("ActionMethod"); + actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest).GetMethod("ActionMethod"); } var httpContext = new Mock(MockBehavior.Loose); @@ -1339,7 +1339,7 @@ namespace Microsoft.AspNet.Mvc inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - var invoker = new TestReflectedActionInvoker( + var invoker = new TestControllerActionInvoker( actionContext, actionBindingContextProvider.Object, filterProvider.Object, @@ -1356,7 +1356,7 @@ namespace Microsoft.AspNet.Mvc { // Arrange Func method = x => 1; - var actionDescriptor = new ReflectedActionDescriptor + var actionDescriptor = new ControllerActionDescriptor { MethodInfo = method.Method, Parameters = new List @@ -1386,7 +1386,7 @@ namespace Microsoft.AspNet.Mvc var inputFormattersProvider = new Mock(); inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - var invoker = new ReflectedActionInvoker(actionContext, + var invoker = new ControllerActionInvoker(actionContext, actionBindingContextProvider.Object, Mock.Of>(), Mock.Of(), @@ -1408,7 +1408,7 @@ namespace Microsoft.AspNet.Mvc { // Arrange Func method = x => 1; - var actionDescriptor = new ReflectedActionDescriptor + var actionDescriptor = new ControllerActionDescriptor { MethodInfo = method.Method, Parameters = new List @@ -1446,7 +1446,7 @@ namespace Microsoft.AspNet.Mvc var inputFormattersProvider = new Mock(); inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - var invoker = new ReflectedActionInvoker(actionContext, + var invoker = new ControllerActionInvoker(actionContext, actionBindingContextProvider.Object, Mock.Of>(), Mock.Of(), @@ -1467,7 +1467,7 @@ namespace Microsoft.AspNet.Mvc [Fact] public async Task GetActionArguments_NoInputFormatterFound_SetsModelStateError() { - var actionDescriptor = new ReflectedActionDescriptor + var actionDescriptor = new ControllerActionDescriptor { MethodInfo = typeof(TestController).GetTypeInfo().GetMethod("ActionMethodWithDefaultValues"), Parameters = new List @@ -1501,7 +1501,7 @@ namespace Microsoft.AspNet.Mvc var inputFormattersProvider = new Mock(); inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - var invoker = new ReflectedActionInvoker(actionContext, + var invoker = new ControllerActionInvoker(actionContext, actionBindingContextProvider.Object, Mock.Of>(), controllerFactory.Object, @@ -1527,7 +1527,7 @@ namespace Microsoft.AspNet.Mvc public async Task Invoke_UsesDefaultValuesIfNotBound() { // Arrange - var actionDescriptor = new ReflectedActionDescriptor + var actionDescriptor = new ControllerActionDescriptor { MethodInfo = typeof(TestController).GetTypeInfo() .DeclaredMethods @@ -1569,7 +1569,7 @@ namespace Microsoft.AspNet.Mvc var inputFormattersProvider = new Mock(); inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - var invoker = new ReflectedActionInvoker(actionContext, + var invoker = new ControllerActionInvoker(actionContext, actionBindingContextProvider.Object, Mock.Of>(), controllerFactory.Object, @@ -1625,16 +1625,16 @@ namespace Microsoft.AspNet.Mvc } } - public class TestReflectedActionInvoker : ReflectedActionInvoker + public class TestControllerActionInvoker : ControllerActionInvoker { private Mock _factoryMock; - public TestReflectedActionInvoker( + public TestControllerActionInvoker( ActionContext actionContext, IActionBindingContextProvider bindingContextProvider, INestedProviderManager filterProvider, Mock controllerFactoryMock, - ReflectedActionDescriptor descriptor, + ControllerActionDescriptor descriptor, IInputFormattersProvider inputFormattersProvider, IBodyModelValidator bodyModelValidator) : base(actionContext, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDiscoveryConventionsActionSelectionTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDiscoveryConventionsActionSelectionTests.cs index 0980f3b270..ca3f70af72 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDiscoveryConventionsActionSelectionTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionDiscoveryConventionsActionSelectionTests.cs @@ -97,12 +97,12 @@ namespace Microsoft.AspNet.Mvc return await defaultActionSelector.SelectAsync(context); } - private ReflectedActionDescriptorProvider GetActionDescriptorProvider(DefaultActionDiscoveryConventions actionDiscoveryConventions) + private ControllerActionDescriptorProvider GetActionDescriptorProvider(DefaultActionDiscoveryConventions actionDiscoveryConventions) { var assemblies = new Assembly[] { typeof(DefaultActionDiscoveryConventionsActionSelectionTests).GetTypeInfo().Assembly, }; var controllerAssemblyProvider = new Mock(); controllerAssemblyProvider.SetupGet(x => x.CandidateAssemblies).Returns(assemblies); - return new ReflectedActionDescriptorProvider( + return new ControllerActionDescriptorProvider( controllerAssemblyProvider.Object, actionDiscoveryConventions, new TestGlobalFilterProvider(), diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Description/DefaultApiDescriptionProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Description/DefaultApiDescriptionProviderTest.cs index 52be73e027..c674364e84 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Description/DefaultApiDescriptionProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/Description/DefaultApiDescriptionProviderTest.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc.Description public void GetApiDescription_IgnoresActionWithoutApiExplorerData() { // Arrange - var action = new ReflectedActionDescriptor(); + var action = new ControllerActionDescriptor(); // Act var descriptions = GetApiDescriptions(action); @@ -387,9 +387,9 @@ namespace Microsoft.AspNet.Mvc.Description return formatters; } - private ReflectedActionDescriptor CreateActionDescriptor(string methodName = null) + private ControllerActionDescriptor CreateActionDescriptor(string methodName = null) { - var action = new ReflectedActionDescriptor(); + var action = new ControllerActionDescriptor(); action.SetProperty(new ApiDescriptionActionData()); action.MethodInfo = GetType().GetMethod( diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/InputObjectBindingTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/InputObjectBindingTests.cs index 9d9a8bb7ac..c7863edad1 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/InputObjectBindingTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/InputObjectBindingTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var input = "" + "" + sampleName + ""; var modelStateDictionary = new ModelStateDictionary(); - var invoker = GetReflectedActionInvoker( + var invoker = GetControllerActionInvoker( input, typeof(Person), new XmlSerializerInputFormatter(), "application/xml"); // Act @@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var input = "" + "" + sampleName + "" + sampleUserName + ""; var modelStateDictionary = new ModelStateDictionary(); - var invoker = GetReflectedActionInvoker(input, typeof(User), new XmlSerializerInputFormatter(), "application/xml"); + var invoker = GetControllerActionInvoker(input, typeof(User), new XmlSerializerInputFormatter(), "application/xml"); // Act var result = await invoker.GetActionArguments(modelStateDictionary); @@ -76,7 +76,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var input = "{'Users': [{Name : '" + sampleFirstUser + "', UserName: '" + sampleFirstUserName + "'}, {Name: '" + sampleSecondUser + "', UserName: '" + sampleSecondUserName + "'}]}"; var modelStateDictionary = new ModelStateDictionary(); - var invoker = GetReflectedActionInvoker(input, typeof(Customers), new JsonInputFormatter(), "application/xml"); + var invoker = GetControllerActionInvoker(input, typeof(Customers), new JsonInputFormatter(), "application/xml"); // Act var result = await invoker.GetActionArguments(modelStateDictionary); @@ -103,7 +103,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var input = "{'Users': [{Name : '" + sampleFirstUser + "', UserName: '" + sampleFirstUserName + "'}, {Name: '" + sampleSecondUser + "', UserName: '" + sampleSecondUserName + "'}]}"; var modelStateDictionary = new ModelStateDictionary(); - var invoker = GetReflectedActionInvoker(input, typeof(Customers), new JsonInputFormatter(), "application/xml"); + var invoker = GetControllerActionInvoker(input, typeof(Customers), new JsonInputFormatter(), "application/xml"); // Act var result = await invoker.GetActionArguments(modelStateDictionary); @@ -125,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test Assert.Equal(sampleSecondUserName, model.Users[1].UserName); } - private static ReflectedActionInvoker GetReflectedActionInvoker( + private static ControllerActionInvoker GetControllerActionInvoker( string input, Type parameterType, IInputFormatter selectedFormatter, string contentType) { var mvcOptions = new MvcOptions(); @@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test accessor.Object, Mock.Of(), Mock.Of()); Func method = x => 1; - var actionDescriptor = new ReflectedActionDescriptor + var actionDescriptor = new ControllerActionDescriptor { MethodInfo = method.Method, Parameters = new List @@ -173,7 +173,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var inputFormattersProvider = new Mock(); inputFormattersProvider.SetupGet(o => o.InputFormatters) .Returns(new List()); - return new ReflectedActionInvoker(actionContext, + return new ControllerActionInvoker(actionContext, actionBindingContextProvider.Object, Mock.Of>(), Mock.Of(), diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Routing/AttributeRoutingTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Routing/AttributeRoutingTest.cs index bfb67f3674..7075c69284 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Routing/AttributeRoutingTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/Routing/AttributeRoutingTest.cs @@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Mvc.Routing var controllerType = typeof(HomeController); var actionMethod = controllerType.GetMethod("Index"); - var action = new ReflectedActionDescriptor(); + var action = new ControllerActionDescriptor(); action.DisplayName = "Microsoft.AspNet.Mvc.Routing.AttributeRoutingTest+HomeController.Index"; action.MethodInfo = actionMethod; action.RouteConstraints = new List() diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ReflectedModelTest.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs similarity index 90% rename from test/Microsoft.AspNet.Mvc.FunctionalTests/ReflectedModelTest.cs rename to test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs index 2059646766..049319a710 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ReflectedModelTest.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/ApplicationModelTest.cs @@ -10,10 +10,10 @@ using System.Net; namespace Microsoft.AspNet.Mvc.FunctionalTests { - public class ReflectedModelTest + public class ApplicationModelTest { - private readonly IServiceProvider _services = TestHelper.CreateServices(nameof(ReflectedModelWebSite)); - private readonly Action _app = new ReflectedModelWebSite.Startup().Configure; + private readonly IServiceProvider _services = TestHelper.CreateServices(nameof(ApplicationModelWebSite)); + private readonly Action _app = new ApplicationModelWebSite.Startup().Configure; [Fact] public async Task ControllerModel_CustomizedWithAttribute() @@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests var client = server.CreateClient(); // Act - var response = await client.GetAsync("http://localhost/ReflectedActionModel/ActionName"); + var response = await client.GetAsync("http://localhost/ActionModel/ActionName"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests var client = server.CreateClient(); // Act - var response = await client.GetAsync("http://localhost/ReflectedParameterModel/GetParameterIsOptional"); + var response = await client.GetAsync("http://localhost/ParameterModel/GetParameterIsOptional"); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json index 42208e1d42..fd90cc931c 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json @@ -7,6 +7,7 @@ "AddServicesWebSite": "1.0.0", "AntiForgeryWebSite": "1.0.0", "ApiExplorerWebSite": "1.0.0", + "ApplicationModelWebSite": "1.0.0", "BasicWebSite": "1.0.0", "CompositeViewEngine": "1.0.0", "ConnegWebSite": "1.0.0", @@ -17,7 +18,6 @@ "VersioningWebSite": "1.0.0", "ModelBindingWebSite": "1.0.0", "MvcSample.Web": "1.0.0", - "ReflectedModelWebSite": "1.0.0", "RoutingWebSite": "1.0.0", "RazorWebSite": "1.0.0", "RazorInstrumentationWebsite": "1.0.0", diff --git a/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityDisabledConvention.cs b/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityDisabledConvention.cs index 20cad66147..5c5d9a3a18 100644 --- a/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityDisabledConvention.cs +++ b/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityDisabledConvention.cs @@ -3,14 +3,14 @@ using System; using System.Reflection; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; namespace ApiExplorer { // Disables ApiExplorer for a specific controller type. // This is part of the test that validates that ApiExplorer can be configured via // convention - public class ApiExplorerVisibilityDisabledConvention : IReflectedApplicationModelConvention + public class ApiExplorerVisibilityDisabledConvention : IGlobalModelConvention { private readonly TypeInfo _type; @@ -19,7 +19,7 @@ namespace ApiExplorer _type = type.GetTypeInfo(); } - public void Apply(ReflectedApplicationModel model) + public void Apply(GlobalModel model) { foreach (var controller in model.Controllers) { diff --git a/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityEnabledConvention.cs b/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityEnabledConvention.cs index 940434e20c..aefd4734fc 100644 --- a/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityEnabledConvention.cs +++ b/test/WebSites/ApiExplorerWebSite/ApiExplorerVisibilityEnabledConvention.cs @@ -1,16 +1,16 @@ // 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 Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; namespace ApiExplorer { // Enables ApiExplorer for controllers that haven't explicitly configured it. // This is part of the test that validates that ApiExplorer can be configured via // convention - public class ApiExplorerVisibilityEnabledConvention : IReflectedApplicationModelConvention + public class ApiExplorerVisibilityEnabledConvention : IGlobalModelConvention { - public void Apply(ReflectedApplicationModel model) + public void Apply(GlobalModel model) { foreach (var controller in model.Controllers) { diff --git a/test/WebSites/ReflectedModelWebSite/ReflectedModelWebSite.kproj b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.kproj similarity index 94% rename from test/WebSites/ReflectedModelWebSite/ReflectedModelWebSite.kproj rename to test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.kproj index 916eaf2b7c..956885846c 100644 --- a/test/WebSites/ReflectedModelWebSite/ReflectedModelWebSite.kproj +++ b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.kproj @@ -6,7 +6,7 @@ - c2ef54f8-8886-4260-a322-44f76245f95d + cae52cb7-0fac-4b5b-8251-b0ff837db657 Web ReflectedModelWebSite diff --git a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedActionModelController.cs b/test/WebSites/ApplicationModelWebSite/Controllers/ActionModelController.cs similarity index 66% rename from test/WebSites/ReflectedModelWebSite/Controllers/ReflectedActionModelController.cs rename to test/WebSites/ApplicationModelWebSite/Controllers/ActionModelController.cs index 7d72dd97f3..46e667db62 100644 --- a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedActionModelController.cs +++ b/test/WebSites/ApplicationModelWebSite/Controllers/ActionModelController.cs @@ -3,23 +3,23 @@ using System; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; -namespace ReflectedModelWebSite +namespace ApplicationModelWebSite { // This controller uses an reflected model attribute to change an action name, and thus // the URL. - public class ReflectedActionModelController : Controller + public class ActionModelController : Controller { [ActionName2("ActionName")] public string GetActionName() { - var actionDescriptor = (ReflectedActionDescriptor)ActionContext.ActionDescriptor; + var actionDescriptor = (ControllerActionDescriptor)ActionContext.ActionDescriptor; return actionDescriptor.Name; } - private class ActionName2Attribute : Attribute, IReflectedActionModelConvention + private class ActionName2Attribute : Attribute, IActionModelConvention { private readonly string _actionName; @@ -28,7 +28,7 @@ namespace ReflectedModelWebSite _actionName = actionName; } - public void Apply(ReflectedActionModel model) + public void Apply(ActionModel model) { model.ActionName = _actionName; } diff --git a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedControllerModelController.cs b/test/WebSites/ApplicationModelWebSite/Controllers/ControllerModelController.cs similarity index 67% rename from test/WebSites/ReflectedModelWebSite/Controllers/ReflectedControllerModelController.cs rename to test/WebSites/ApplicationModelWebSite/Controllers/ControllerModelController.cs index df9a7f1f4e..57aef9b9b2 100644 --- a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedControllerModelController.cs +++ b/test/WebSites/ApplicationModelWebSite/Controllers/ControllerModelController.cs @@ -3,23 +3,23 @@ using System; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; -namespace ReflectedModelWebSite +namespace ApplicationModelWebSite { // This controller uses an reflected model attribute to change the controller name, and thus // the URL. [ControllerName("CoolController")] - public class ReflectedControllerModelController : Controller + public class ControllerModelController : Controller { public string GetControllerName() { - var actionDescriptor = (ReflectedActionDescriptor)ActionContext.ActionDescriptor; + var actionDescriptor = (ControllerActionDescriptor)ActionContext.ActionDescriptor; return actionDescriptor.ControllerName; } - private class ControllerNameAttribute : Attribute, IReflectedControllerModelConvention + private class ControllerNameAttribute : Attribute, IControllerModelConvention { private readonly string _controllerName; @@ -28,7 +28,7 @@ namespace ReflectedModelWebSite _controllerName = controllerName; } - public void Apply(ReflectedControllerModel model) + public void Apply(ControllerModel model) { model.ControllerName = _controllerName; } diff --git a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedParameterModelController.cs b/test/WebSites/ApplicationModelWebSite/Controllers/ParameterModelController.cs similarity index 60% rename from test/WebSites/ReflectedModelWebSite/Controllers/ReflectedParameterModelController.cs rename to test/WebSites/ApplicationModelWebSite/Controllers/ParameterModelController.cs index f9ef95dcfa..c4a36ea012 100644 --- a/test/WebSites/ReflectedModelWebSite/Controllers/ReflectedParameterModelController.cs +++ b/test/WebSites/ApplicationModelWebSite/Controllers/ParameterModelController.cs @@ -3,23 +3,23 @@ using System; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.ReflectedModelBuilder; +using Microsoft.AspNet.Mvc.ApplicationModel; -namespace ReflectedModelWebSite +namespace ApplicationModelWebSite { // This controller uses an reflected model attribute to change a parameter to optional. - public class ReflectedParameterModelController : Controller + public class ParameterModelController : Controller { public string GetParameterIsOptional([Optional] int? id) { - var actionDescriptor = (ReflectedActionDescriptor)ActionContext.ActionDescriptor; + var actionDescriptor = (ControllerActionDescriptor)ActionContext.ActionDescriptor; return actionDescriptor.Parameters[0].IsOptional.ToString(); } - private class OptionalAttribute : Attribute, IReflectedParameterModelConvention + private class OptionalAttribute : Attribute, IParameterModelConvention { - public void Apply(ReflectedParameterModel model) + public void Apply(ParameterModel model) { model.IsOptional = true; } diff --git a/test/WebSites/ReflectedModelWebSite/Startup.cs b/test/WebSites/ApplicationModelWebSite/Startup.cs similarity index 94% rename from test/WebSites/ReflectedModelWebSite/Startup.cs rename to test/WebSites/ApplicationModelWebSite/Startup.cs index 2d5bb2bb84..b736e8dc42 100644 --- a/test/WebSites/ReflectedModelWebSite/Startup.cs +++ b/test/WebSites/ApplicationModelWebSite/Startup.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Builder; using Microsoft.Framework.DependencyInjection; -namespace ReflectedModelWebSite +namespace ApplicationModelWebSite { public class Startup { diff --git a/test/WebSites/ReflectedModelWebSite/project.json b/test/WebSites/ApplicationModelWebSite/project.json similarity index 100% rename from test/WebSites/ReflectedModelWebSite/project.json rename to test/WebSites/ApplicationModelWebSite/project.json diff --git a/test/WebSites/BasicWebSite/ActionDescriptorCreationCounter.cs b/test/WebSites/BasicWebSite/ActionDescriptorCreationCounter.cs index 1be89a7aeb..73a30a3e35 100644 --- a/test/WebSites/BasicWebSite/ActionDescriptorCreationCounter.cs +++ b/test/WebSites/BasicWebSite/ActionDescriptorCreationCounter.cs @@ -22,7 +22,7 @@ namespace BasicWebSite { get { - return ReflectedActionDescriptorProvider.DefaultOrder - 100; + return ControllerActionDescriptorProvider.DefaultOrder - 100; } } diff --git a/test/WebSites/RoutingWebSite/TestResponseGenerator.cs b/test/WebSites/RoutingWebSite/TestResponseGenerator.cs index b5acea56e9..3995ed4dc0 100644 --- a/test/WebSites/RoutingWebSite/TestResponseGenerator.cs +++ b/test/WebSites/RoutingWebSite/TestResponseGenerator.cs @@ -47,7 +47,7 @@ namespace RoutingWebSite routeValues = new Dictionary(_actionContext.RouteData.Values), action = _actionContext.ActionDescriptor.Name, - controller = ((ReflectedActionDescriptor)_actionContext.ActionDescriptor).ControllerDescriptor.Name, + controller = ((ControllerActionDescriptor)_actionContext.ActionDescriptor).ControllerDescriptor.Name, link, }); diff --git a/test/WebSites/VersioningWebSite/TestResponseGenerator.cs b/test/WebSites/VersioningWebSite/TestResponseGenerator.cs index 4821b71ee1..8c032cebe4 100644 --- a/test/WebSites/VersioningWebSite/TestResponseGenerator.cs +++ b/test/WebSites/VersioningWebSite/TestResponseGenerator.cs @@ -47,7 +47,7 @@ namespace VersioningWebSite routeValues = new Dictionary(_actionContext.RouteData.Values), action = _actionContext.ActionDescriptor.Name, - controller = ((ReflectedActionDescriptor)_actionContext.ActionDescriptor).ControllerDescriptor.Name, + controller = ((ControllerActionDescriptor)_actionContext.ActionDescriptor).ControllerDescriptor.Name, link, });