diff --git a/Mvc.NoFun.sln b/Mvc.NoFun.sln index 751cfe2c27..2164ee973e 100644 --- a/Mvc.NoFun.sln +++ b/Mvc.NoFun.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.22822.1 +VisualStudioVersion = 14.0.22808.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}" EndProject @@ -70,6 +70,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ApiExp EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ApiExplorer.Test", "test\Microsoft.AspNet.Mvc.ApiExplorer.Test\Microsoft.AspNet.Mvc.ApiExplorer.Test.xproj", "{4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Extensions", "src\Microsoft.AspNet.Mvc.Extensions\Microsoft.AspNet.Mvc.Extensions.xproj", "{B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Extensions.Test", "test\Microsoft.AspNet.Mvc.Extensions.Test\Microsoft.AspNet.Mvc.Extensions.Test.xproj", "{5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -391,6 +395,30 @@ Global {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6}.Release|Mixed Platforms.Build.0 = Release|Any CPU {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6}.Release|x86.ActiveCfg = Release|Any CPU {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6}.Release|x86.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|x86.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|x86.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Any CPU.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|x86.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|x86.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|x86.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|x86.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Any CPU.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|x86.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -424,5 +452,7 @@ Global {DA000953-7532-4DF5-8DB9-8143DF98D999} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {A2B72833-5D70-4C42-AE85-E0319926FB8A} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection EndGlobal diff --git a/Mvc.sln b/Mvc.sln index 12b6171467..34855cae18 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -170,6 +170,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstra EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LocalizationWebSite", "test\WebSites\LocalizationWebSite\LocalizationWebSite.xproj", "{FCFE6024-2720-49B4-8257-9DBC6114F0F1}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Extensions", "src\Microsoft.AspNet.Mvc.Extensions\Microsoft.AspNet.Mvc.Extensions.xproj", "{B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Extensions.Test", "test\Microsoft.AspNet.Mvc.Extensions.Test\Microsoft.AspNet.Mvc.Extensions.Test.xproj", "{5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1024,6 +1028,30 @@ Global {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.ActiveCfg = Release|Any CPU {FCFE6024-2720-49B4-8257-9DBC6114F0F1}.Release|x86.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|x86.ActiveCfg = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Debug|x86.Build.0 = Debug|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Any CPU.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|x86.ActiveCfg = Release|Any CPU + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94}.Release|x86.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|x86.ActiveCfg = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Debug|x86.Build.0 = Debug|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Any CPU.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|x86.ActiveCfg = Release|Any CPU + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1107,5 +1135,7 @@ Global {4C2AD8AB-8AC0-46C4-80C6-C5577C7255F6} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {DA000953-7532-4DF5-8DB9-8143DF98D999} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {FCFE6024-2720-49B4-8257-9DBC6114F0F1} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} + {B2CA101A-87E6-4DD2-9BB2-28DA68EF1A94} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} + {5DF6EFA5-865E-450B-BF83-DE9CE88EB77C} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection EndGlobal diff --git a/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiDescription.cs b/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiDescription.cs index c7701ef8f8..6386c5872d 100644 --- a/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiDescription.cs +++ b/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiDescription.cs @@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc.ApiExplorer /// /// /// Will be null if the action returns no response, or if the response type is unclear. Use - /// on an action method to specify a response type. + /// ProducesAttribute on an action method to specify a response type. /// public Type ResponseType { get; set; } @@ -74,7 +74,7 @@ namespace Microsoft.AspNet.Mvc.ApiExplorer /// /// /// Will be empty if the action returns no response, or if the response type is unclear. Use - /// on an action method to specify a response type. + /// ProducesAttribute on an action method to specify a response type. /// public IList SupportedResponseFormats { get; private set; } } diff --git a/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ActionBindingContext.cs b/src/Microsoft.AspNet.Mvc.Core/ActionBindingContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ActionBindingContext.cs rename to src/Microsoft.AspNet.Mvc.Core/ActionBindingContext.cs diff --git a/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiExplorerSettingsAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ApiExplorerSettingsAttribute.cs similarity index 90% rename from src/Microsoft.AspNet.Mvc.ApiExplorer/ApiExplorerSettingsAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ApiExplorerSettingsAttribute.cs index 8229bb7faf..4b1e4d7407 100644 --- a/src/Microsoft.AspNet.Mvc.ApiExplorer/ApiExplorerSettingsAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApiExplorerSettingsAttribute.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Mvc.ApiExplorer; namespace Microsoft.AspNet.Mvc { /// - /// Controls the visibility and group name for an + /// Controls the visibility and group name for an ApiDescription /// of the associated controller class or action method. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] diff --git a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultApplicationModelProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultApplicationModelProvider.cs index 81bd32780f..b02f14a3de 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultApplicationModelProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ApplicationModels/DefaultApplicationModelProvider.cs @@ -5,8 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using Microsoft.AspNet.Authorization; -using Microsoft.AspNet.Cors.Core; using Microsoft.AspNet.Mvc.ApiExplorer; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.ModelBinding; @@ -18,15 +16,11 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { public class DefaultApplicationModelProvider : IApplicationModelProvider { - private readonly AuthorizationOptions _authorizationOptions; private readonly ICollection _globalFilters; - public DefaultApplicationModelProvider( - IOptions mvcOptionsAccessor, - IOptions authorizationOptionsAccessor) + public DefaultApplicationModelProvider(IOptions mvcOptionsAccessor) { _globalFilters = mvcOptionsAccessor.Options.Filters; - _authorizationOptions = authorizationOptionsAccessor.Options; } /// @@ -182,24 +176,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels AddRange(controllerModel.Filters, attributes.OfType()); AddRange(controllerModel.RouteConstraints, attributes.OfType()); - var enableCors = attributes.OfType().SingleOrDefault(); - if (enableCors != null) - { - controllerModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName)); - } - - var disableCors = attributes.OfType().SingleOrDefault(); - if (disableCors != null) - { - controllerModel.Filters.Add(new DisableCorsAuthorizationFilter()); - } - - var policy = AuthorizationPolicy.Combine(_authorizationOptions, attributes.OfType()); - if (policy != null) - { - controllerModel.Filters.Add(new AuthorizeFilter(policy)); - } - var apiVisibility = attributes.OfType().FirstOrDefault(); if (apiVisibility != null) { @@ -529,24 +505,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels AddRange(actionModel.ActionConstraints, attributes.OfType()); AddRange(actionModel.Filters, attributes.OfType()); - var enableCors = attributes.OfType().SingleOrDefault(); - if (enableCors != null) - { - actionModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName)); - } - - var disableCors = attributes.OfType().SingleOrDefault(); - if (disableCors != null) - { - actionModel.Filters.Add(new DisableCorsAuthorizationFilter()); - } - - var policy = AuthorizationPolicy.Combine(_authorizationOptions, attributes.OfType()); - if (policy != null) - { - actionModel.Filters.Add(new AuthorizeFilter(policy)); - } - var actionName = attributes.OfType().FirstOrDefault(); if (actionName?.Name != null) { diff --git a/src/Microsoft.AspNet.Mvc.Core/Areas/AreaAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/AreaAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Areas/AreaAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/AreaAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs index 29aacd2bf2..303016558d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptorProvider.cs @@ -69,4 +69,4 @@ namespace Microsoft.AspNet.Mvc.Core return context.Result; } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ControllerActionFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ControllerActionFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerActionFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ControllerResultFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerResultFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ControllerResultFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ControllerResultFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionConstraints/DefaultActionConstraintProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultActionConstraintProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionConstraints/DefaultActionConstraintProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/DefaultActionConstraintProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs index a8c3c8726b..650b61339d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs @@ -33,6 +33,7 @@ namespace Microsoft.AspNet.Mvc "Microsoft.AspNet.Mvc.Abstractions", "Microsoft.AspNet.Mvc.ApiExplorer", "Microsoft.AspNet.Mvc.Core", + "Microsoft.AspNet.Mvc.Extensions", "Microsoft.AspNet.Mvc.Razor", "Microsoft.AspNet.Mvc.Razor.Host", "Microsoft.AspNet.Mvc.TagHelpers", diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs index 3c0d5a64c2..25f7eafea8 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs @@ -19,20 +19,24 @@ namespace Microsoft.AspNet.Mvc public class DefaultControllerFactory : IControllerFactory { private readonly IControllerActivator _controllerActivator; - private readonly ConcurrentDictionary[]> _activateActions; - private readonly Func[]> _getPropertiesToActivate; + private readonly IControllerPropertyActivator[] _propertyActivators; /// /// Initializes a new instance of . /// - /// used to create controller - /// instances. - public DefaultControllerFactory(IControllerActivator controllerActivator) + /// + /// used to create controller instances. + /// + /// + /// A set of instances used to initialize controller + /// properties. + /// + public DefaultControllerFactory( + IControllerActivator controllerActivator, + IEnumerable propertyActivators) { _controllerActivator = controllerActivator; - - _activateActions = new ConcurrentDictionary[]>(); - _getPropertiesToActivate = GetPropertiesToActivate; + _propertyActivators = propertyActivators.ToArray(); } /// @@ -71,7 +75,10 @@ namespace Microsoft.AspNet.Mvc } var controller = _controllerActivator.Create(actionContext, controllerType); - ActivateProperties(controller, actionContext); + foreach (var propertyActivator in _propertyActivators) + { + propertyActivator.Activate(actionContext, controller); + } return controller; } @@ -86,60 +93,5 @@ namespace Microsoft.AspNet.Mvc disposableController.Dispose(); } } - - /// - /// Activates the specified controller using the specified action context. - /// - /// The controller to activate. - /// The context of the executing action. - protected virtual void ActivateProperties([NotNull] object controller, [NotNull] ActionContext context) - { - var controllerType = controller.GetType(); - var propertiesToActivate = _activateActions.GetOrAdd( - controllerType, - _getPropertiesToActivate); - - for (var i = 0; i < propertiesToActivate.Length; i++) - { - var activateInfo = propertiesToActivate[i]; - activateInfo.Activate(controller, context); - } - } - - private PropertyActivator[] GetPropertiesToActivate(Type type) - { - IEnumerable> activators; - activators = PropertyActivator.GetPropertiesToActivate( - type, - typeof(ActionContextAttribute), - p => new PropertyActivator(p, c => c)); - - activators = activators.Concat(PropertyActivator.GetPropertiesToActivate( - type, - typeof(ActionBindingContextAttribute), - p => new PropertyActivator(p, GetActionBindingContext))); - - activators = activators.Concat(PropertyActivator.GetPropertiesToActivate( - type, - typeof(ViewDataDictionaryAttribute), - p => new PropertyActivator(p, GetViewDataDictionary))); - - return activators.ToArray(); - } - - private static ActionBindingContext GetActionBindingContext(ActionContext context) - { - var serviceProvider = context.HttpContext.RequestServices; - var accessor = serviceProvider.GetRequiredService>(); - return accessor.Value; - } - - private static ViewDataDictionary GetViewDataDictionary(ActionContext context) - { - var serviceProvider = context.HttpContext.RequestServices; - return new ViewDataDictionary( - serviceProvider.GetRequiredService(), - context.ModelState); - } } } diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerPropertyActivator.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerPropertyActivator.cs new file mode 100644 index 0000000000..44b67e9a9c --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerPropertyActivator.cs @@ -0,0 +1,61 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.Internal; + +namespace Microsoft.AspNet.Mvc +{ + public class DefaultControllerPropertyActivator : IControllerPropertyActivator + { + private readonly ConcurrentDictionary[]> _activateActions; + private readonly Func[]> _getPropertiesToActivate; + + public DefaultControllerPropertyActivator() + { + _activateActions = new ConcurrentDictionary[]>(); + _getPropertiesToActivate = GetPropertiesToActivate; + } + + public void Activate(ActionContext actionContext, object controller) + { + var controllerType = controller.GetType(); + var propertiesToActivate = _activateActions.GetOrAdd( + controllerType, + _getPropertiesToActivate); + + for (var i = 0; i < propertiesToActivate.Length; i++) + { + var activateInfo = propertiesToActivate[i]; + activateInfo.Activate(controller, actionContext); + } + } + + private PropertyActivator[] GetPropertiesToActivate(Type type) + { + IEnumerable> activators; + activators = PropertyActivator.GetPropertiesToActivate( + type, + typeof(ActionContextAttribute), + p => new PropertyActivator(p, c => c)); + + activators = activators.Concat(PropertyActivator.GetPropertiesToActivate( + type, + typeof(ActionBindingContextAttribute), + p => new PropertyActivator(p, GetActionBindingContext))); + + return activators.ToArray(); + } + + private static ActionBindingContext GetActionBindingContext(ActionContext context) + { + var serviceProvider = context.HttpContext.RequestServices; + var accessor = serviceProvider.GetRequiredService>(); + return accessor.Value; + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerTypeProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerTypeProvider.cs index b31da1f26b..c6828c6e38 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerTypeProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerTypeProvider.cs @@ -15,8 +15,7 @@ namespace Microsoft.AspNet.Mvc /// public class DefaultControllerTypeProvider : IControllerTypeProvider { - private const string ControllerTypeName = nameof(Controller); - private static readonly TypeInfo ControllerTypeInfo = typeof(Controller).GetTypeInfo(); + private const string ControllerTypeName = "Controller"; private static readonly TypeInfo ObjectTypeInfo = typeof(object).GetTypeInfo(); private readonly IAssemblyProvider _assemblyProvider; @@ -83,14 +82,6 @@ namespace Microsoft.AspNet.Mvc private bool DerivesFromController(TypeInfo typeInfo, ISet candidateAssemblies) { - // A type is a controller if it derives from a type that is either named "Controller" or has the suffix - // "Controller". We'll optimize the most common case of types deriving from the Mvc Controller type and - // walk up the object graph if that's not the case. - if (ControllerTypeInfo.IsAssignableFrom(typeInfo)) - { - return true; - } - while (typeInfo != ObjectTypeInfo) { var baseTypeInfo = typeInfo.BaseType.GetTypeInfo(); @@ -105,6 +96,12 @@ namespace Microsoft.AspNet.Mvc return true; } + // c). The base type is called 'Controller. + if (string.Equals(baseTypeInfo.Name, ControllerTypeName, StringComparison.Ordinal)) + { + return true; + } + typeInfo = baseTypeInfo; } diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/DefaultFilterProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultFilterProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/DefaultFilterProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/DefaultFilterProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultOrder.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultOrder.cs index d4c816baea..1f9d0b0fe6 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultOrder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultOrder.cs @@ -13,8 +13,8 @@ namespace Microsoft.AspNet.Mvc public static readonly int DefaultFrameworkSortOrder = -1000; /// - /// The default order for , - /// and . + /// The default order for CorsAuthorizationFilter, CorsAuthorizationFilterFactory + /// and DisableCorsAuthorizationFilter /// public static readonly int DefaultCorsSortOrder = int.MaxValue - 100; } diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/EmptyResult.cs b/src/Microsoft.AspNet.Mvc.Core/EmptyResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/EmptyResult.cs rename to src/Microsoft.AspNet.Mvc.Core/EmptyResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FilterCollectionExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/FilterCollectionExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FilterCollectionExtensions.cs rename to src/Microsoft.AspNet.Mvc.Core/FilterCollectionExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FilterDescriptorOrderComparer.cs b/src/Microsoft.AspNet.Mvc.Core/FilterDescriptorOrderComparer.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FilterDescriptorOrderComparer.cs rename to src/Microsoft.AspNet.Mvc.Core/FilterDescriptorOrderComparer.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FilterItemOrderComparer.cs b/src/Microsoft.AspNet.Mvc.Core/FilterItemOrderComparer.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FilterItemOrderComparer.cs rename to src/Microsoft.AspNet.Mvc.Core/FilterItemOrderComparer.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FilterScope.cs b/src/Microsoft.AspNet.Mvc.Core/FilterScope.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FilterScope.cs rename to src/Microsoft.AspNet.Mvc.Core/FilterScope.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/HttpNoContentOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/HttpNoContentOutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/HttpNoContentOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/HttpNoContentOutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/HttpNotAcceptableOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/HttpNotAcceptableOutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/HttpNotAcceptableOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/HttpNotAcceptableOutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/IAssemblyProvider.cs b/src/Microsoft.AspNet.Mvc.Core/IAssemblyProvider.cs index 910c54ed61..d6ef592e57 100644 --- a/src/Microsoft.AspNet.Mvc.Core/IAssemblyProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/IAssemblyProvider.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc public interface IAssemblyProvider { /// - /// Gets the sequence of candidate ies that the application + /// Gets the sequence of candidate instances that the application /// uses for discovery of Mvc specific types. /// IEnumerable CandidateAssemblies { get; } diff --git a/src/Microsoft.AspNet.Mvc.Core/IControllerPropertyActivator.cs b/src/Microsoft.AspNet.Mvc.Core/IControllerPropertyActivator.cs new file mode 100644 index 0000000000..c67453413c --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/IControllerPropertyActivator.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNet.Mvc +{ + public interface IControllerPropertyActivator + { + void Activate(ActionContext actionContext, object controller); + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/InputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/InputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/InputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/InputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBindingHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBindingHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs b/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs index 6e753cd07a..50544ee488 100644 --- a/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs +++ b/src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs @@ -1,17 +1,12 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Mvc.ApplicationModels; -using Microsoft.AspNet.Mvc.Core; -using Microsoft.AspNet.Mvc.Core.Internal; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Metadata; using Microsoft.AspNet.Mvc.ModelBinding.Validation; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.Framework.Internal; -using Newtonsoft.Json; namespace Microsoft.AspNet.Mvc { @@ -20,57 +15,21 @@ namespace Microsoft.AspNet.Mvc /// public class MvcOptions { - private AntiForgeryOptions _antiForgeryOptions = new AntiForgeryOptions(); private int _maxModelStateErrors = ModelStateDictionary.DefaultMaxAllowedErrors; public MvcOptions() { Conventions = new List(); - ModelBinders = new List(); - ViewEngines = new List(); - ValueProviderFactories = new List(); - OutputFormatters = new List(); - InputFormatters = new List(); Filters = new List(); - FormatterMappings = new FormatterMappings(); - ValidationExcludeFilters = new List(); + InputFormatters = new List(); + OutputFormatters = new List(); + ModelBinders = new List(); ModelMetadataDetailsProviders = new List(); ModelValidatorProviders = new List(); - ClientModelValidatorProviders = new List(); - CacheProfiles = new Dictionary(StringComparer.OrdinalIgnoreCase); - HtmlHelperOptions = new HtmlHelperOptions(); - SerializerSettings = SerializerSettingsProvider.CreateSerializerSettings(); + ValidationExcludeFilters = new List(); + ValueProviderFactories = new List(); } - /// - /// Provides programmatic configuration for the anti-forgery token system. - /// - public AntiForgeryOptions AntiForgeryOptions - { - get - { - return _antiForgeryOptions; - } - - set - { - if (value == null) - { - throw new ArgumentNullException(nameof(value), - Resources.FormatPropertyOfTypeCannotBeNull(nameof(AntiForgeryOptions), - typeof(MvcOptions))); - } - - _antiForgeryOptions = value; - } - } - - /// - /// Used to specify mapping between the URL Format and corresponding - /// . - /// - public FormatterMappings FormatterMappings { get; } - /// /// Gets a list of which are used to construct filters that /// apply to all actions. @@ -88,15 +47,9 @@ namespace Microsoft.AspNet.Mvc public IList InputFormatters { get; } /// - /// Gets the that are used by this application. + /// Gets a list of s used by this application. /// - public JsonSerializerSettings SerializerSettings { get; } - - /// - /// Gets a list of s that are used by this application. - /// - public IList ValidationExcludeFilters { get; } - = new List(); + public IList ModelBinders { get; } /// /// Gets or sets the maximum number of validation errors that are allowed by this application before further @@ -116,27 +69,11 @@ namespace Microsoft.AspNet.Mvc } } - /// - /// Gets a list of s used by this application. - /// - public IList ModelBinders { get; } - /// /// Gets a list of s used by this application. /// public IList ModelValidatorProviders { get; } - /// - /// Gets a list of instances. - /// - public IList ClientModelValidatorProviders { get; } - - /// - /// Gets a list of descriptors that represent used - /// by this application. - /// - public IList ViewEngines { get; } - /// /// Gets a list of used by this application. /// @@ -154,12 +91,6 @@ namespace Microsoft.AspNet.Mvc /// public bool RespectBrowserAcceptHeader { get; set; } - /// - /// Gets a Dictionary of CacheProfile Names, which are pre-defined settings for - /// . - /// - public IDictionary CacheProfiles { get; } - /// /// Gets a list of instances that will be used to /// create instances. @@ -176,8 +107,8 @@ namespace Microsoft.AspNet.Mvc public IList ModelMetadataDetailsProviders { get; } /// - /// Gets or sets programmatic configuration for the HTML helpers and . + /// Gets a list of s that are used by this application. /// - public HtmlHelperOptions HtmlHelperOptions { get; [param: NotNull] set; } + public IList ValidationExcludeFilters { get; } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ObjectResult.cs b/src/Microsoft.AspNet.Mvc.Core/ObjectResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/ObjectResult.cs rename to src/Microsoft.AspNet.Mvc.Core/ObjectResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/OutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/OutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/OutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/OutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Mvc.Core/Properties/AssemblyInfo.cs index 22ad5efd56..317891ec69 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Properties/AssemblyInfo.cs @@ -7,6 +7,5 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Core.Test")] [assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Razor.Test")] [assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.TagHelpers.Test")] -[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Xml.Test")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] [assembly: AssemblyMetadata("Serviceable", "True")] diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ServiceFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ServiceFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ServiceFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ServiceFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/StreamOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/StreamOutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/StreamOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/StreamOutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/StringOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Core/StringOutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/StringOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Core/StringOutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/TypeFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/TypeFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/TypeFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/TypeFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/project.json b/src/Microsoft.AspNet.Mvc.Core/project.json index 4763fc94c4..b4ccf7cb1f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/project.json +++ b/src/Microsoft.AspNet.Mvc.Core/project.json @@ -5,42 +5,22 @@ "warningsAsErrors": true }, "dependencies": { - "Microsoft.AspNet.Authentication": "1.0.0-*", - "Microsoft.AspNet.Authorization": "1.0.0-*", "Microsoft.AspNet.Cors.Core": "1.0.0-*", - "Microsoft.AspNet.DataProtection": "1.0.0-*", - "Microsoft.AspNet.Diagnostics.Abstractions": "1.0.0-*", - "Microsoft.AspNet.FileProviders.Abstractions": "1.0.0-*", "Microsoft.AspNet.Hosting.Abstractions": "1.0.0-*", - "Microsoft.AspNet.Http.Extensions": "1.0.0-*", - "Microsoft.AspNet.JsonPatch": "1.0.0-*", "Microsoft.AspNet.Mvc.Abstractions": "6.0.0-*", "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, - "Microsoft.AspNet.Routing": "1.0.0-*", - "Microsoft.Framework.BufferEntryCollection.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.Framework.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.CopyOnWriteDictionary.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", "Microsoft.Framework.Notification": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.PropertyActivator.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.Runtime.Abstractions": "1.0.0-*", - "Microsoft.Framework.WebEncoders": "1.0.0-*" + "Newtonsoft.Json": "6.0.6" }, "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.ComponentModel.DataAnnotations": "", - "System.Runtime.Serialization": "" - } - }, - "dnxcore50": { - "dependencies": { - "System.ComponentModel.Annotations": "4.0.10-beta-*", - "System.Runtime.Serialization.Primitives": "4.0.10-beta-*", - "Microsoft.CSharp": "4.0.0-beta-*" - } - } + "dnx451": { }, + "dnxcore50": { } } } diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ActionFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ActionFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ActionFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ActionFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionConstraints/ActionMethodSelectorAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ActionMethodSelectorAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionConstraints/ActionMethodSelectorAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ActionMethodSelectorAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/AllowAnonymousAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/AllowAnonymousAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/AllowAnonymousAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AllowAnonymousAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgery.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgery.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgery.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgery.cs index 4517c4c0b7..158169fd5e 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgery.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgery.cs @@ -28,11 +28,11 @@ namespace Microsoft.AspNet.Mvc public AntiForgery([NotNull] IClaimUidExtractor claimUidExtractor, [NotNull] IDataProtectionProvider dataProtectionProvider, [NotNull] IAntiForgeryAdditionalDataProvider additionalDataProvider, - [NotNull] IOptions mvcOptions, + [NotNull] IOptions antiforgeryOptions, [NotNull] IHtmlEncoder htmlEncoder, [NotNull] IOptions dataProtectionOptions) { - var config = mvcOptions.Options.AntiForgeryOptions; + var config = antiforgeryOptions.Options; var applicationId = dataProtectionOptions.Options.ApplicationDiscriminator ?? string.Empty; config.CookieName = config.CookieName ?? ComputeCookieName(applicationId); diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryContext.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryContext.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryContext.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryOptions.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryOptions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryOptions.cs index 4f82e766af..1d5ace92b8 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryOptions.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryOptions.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; namespace Microsoft.AspNet.Mvc { diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryToken.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryToken.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryToken.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryToken.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenProvider.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenProvider.cs index f4f739c774..6bb4ab6443 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenProvider.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Security.Claims; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; namespace Microsoft.AspNet.Mvc { diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSerializer.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSerializer.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSerializer.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSerializer.cs index c958edc342..660a0c242f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSerializer.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSerializer.cs @@ -4,7 +4,7 @@ using System; using System.IO; using Microsoft.AspNet.DataProtection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.WebUtilities; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSet.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSet.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSet.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSet.cs index aa1efd7d84..d992ed5ef7 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenSet.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenSet.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; namespace Microsoft.AspNet.Mvc { diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenStore.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenStore.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryTokenStore.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryTokenStore.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryWorker.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryWorker.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryWorker.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryWorker.cs index 99f9316118..64158c32d8 100644 --- a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryWorker.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/AntiForgeryWorker.cs @@ -6,7 +6,7 @@ using System.Diagnostics; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Framework.Internal; using Microsoft.Framework.WebEncoders; diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/BinaryBlob.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/BinaryBlob.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/BinaryBlob.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/BinaryBlob.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/DefaultAntiForgeryAdditionalDataProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/DefaultAntiForgeryAdditionalDataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/DefaultAntiForgeryAdditionalDataProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/DefaultAntiForgeryAdditionalDataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/DefaultClaimUidExtractor.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/DefaultClaimUidExtractor.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/DefaultClaimUidExtractor.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/DefaultClaimUidExtractor.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryAdditionalDataProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryAdditionalDataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryAdditionalDataProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryAdditionalDataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenGenerator.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenGenerator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenGenerator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenGenerator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenSerializer.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenSerializer.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenSerializer.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenSerializer.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenStore.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenStore.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenStore.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenStore.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenValidator.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenValidator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IAntiForgeryTokenValidator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IAntiForgeryTokenValidator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/AntiForgery/IClaimUidExtractor.cs b/src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IClaimUidExtractor.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/AntiForgery/IClaimUidExtractor.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AntiForgery/IClaimUidExtractor.cs diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Authorization/AuthorizationApplicationModelProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/Authorization/AuthorizationApplicationModelProvider.cs new file mode 100644 index 0000000000..90a7d6092a --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Authorization/AuthorizationApplicationModelProvider.cs @@ -0,0 +1,55 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; +using Microsoft.AspNet.Authorization; +using Microsoft.AspNet.Mvc.ApplicationModels; +using Microsoft.Framework.Internal; +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Mvc +{ + public class AuthorizationApplicationModelProvider : IApplicationModelProvider + { + private readonly AuthorizationOptions _authorizationOptions; + + public AuthorizationApplicationModelProvider(IOptions authorizationOptionsAccessor) + { + _authorizationOptions = authorizationOptionsAccessor.Options; + } + + public int Order { get { return DefaultOrder.DefaultFrameworkSortOrder + 10; } } + + public void OnProvidersExecuted([NotNull]ApplicationModelProviderContext context) + { + // Intentionally empty. + } + + public void OnProvidersExecuting([NotNull]ApplicationModelProviderContext context) + { + AuthorizationPolicy policy; + + foreach (var controllerModel in context.Result.Controllers) + { + policy = AuthorizationPolicy.Combine( + _authorizationOptions, + controllerModel.Attributes.OfType()); + if (policy != null) + { + controllerModel.Filters.Add(new AuthorizeFilter(policy)); + } + + foreach (var actionModel in controllerModel.Actions) + { + policy = AuthorizationPolicy.Combine( + _authorizationOptions, + actionModel.Attributes.OfType()); + if (policy != null) + { + actionModel.Filters.Add(new AuthorizeFilter(policy)); + } + } + } + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/AuthorizeFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Authorization/AuthorizeFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/AuthorizeFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Authorization/AuthorizeFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/IAllowAnonymous.cs b/src/Microsoft.AspNet.Mvc.Extensions/Authorization/IAllowAnonymous.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/IAllowAnonymous.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Authorization/IAllowAnonymous.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/AuthorizationFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/AuthorizationFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/AuthorizationFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/AuthorizationFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/BadRequestObjectResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/BadRequestObjectResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/BadRequestObjectResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/BadRequestObjectResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/BadRequestResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/BadRequestResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/BadRequestResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/BadRequestResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/CacheProfile.cs b/src/Microsoft.AspNet.Mvc.Extensions/CacheProfile.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/CacheProfile.cs rename to src/Microsoft.AspNet.Mvc.Extensions/CacheProfile.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ChallengeResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ChallengeResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/ChallengeResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ChallengeResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionConstraints/ConsumesAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Consumes/ConsumesAttribute.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ActionConstraints/ConsumesAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Consumes/ConsumesAttribute.cs index a0a651ed7f..811d6c295f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionConstraints/ConsumesAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Consumes/ConsumesAttribute.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionConstraints/IConsumesActionConstraint.cs b/src/Microsoft.AspNet.Mvc.Extensions/Consumes/IConsumesActionConstraint.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionConstraints/IConsumesActionConstraint.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Consumes/IConsumesActionConstraint.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ContentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ContentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/ContentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ContentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Controller.cs b/src/Microsoft.AspNet.Mvc.Extensions/Controller.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Controller.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Controller.cs index b4707f3e4e..ae078f08f5 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Controller.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Controller.cs @@ -8,7 +8,7 @@ using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Mvc.Rendering; diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsApplicationModelProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsApplicationModelProvider.cs new file mode 100644 index 0000000000..04618c3b3d --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsApplicationModelProvider.cs @@ -0,0 +1,56 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; +using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Mvc.ApplicationModels; +using Microsoft.Framework.Internal; + +namespace Microsoft.AspNet.Mvc +{ + public class CorsApplicationModelProvider : IApplicationModelProvider + { + public int Order { get { return DefaultOrder.DefaultFrameworkSortOrder + 10; } } + + public void OnProvidersExecuted([NotNull]ApplicationModelProviderContext context) + { + // Intentionally empty. + } + + public void OnProvidersExecuting([NotNull]ApplicationModelProviderContext context) + { + IEnableCorsAttribute enableCors; + IDisableCorsAttribute disableCors; + + foreach (var controllerModel in context.Result.Controllers) + { + enableCors = controllerModel.Attributes.OfType().FirstOrDefault(); + if (enableCors != null) + { + controllerModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName)); + } + + disableCors = controllerModel.Attributes.OfType().FirstOrDefault(); + if (disableCors != null) + { + controllerModel.Filters.Add(new DisableCorsAuthorizationFilter()); + } + + foreach (var actionModel in controllerModel.Actions) + { + enableCors = actionModel.Attributes.OfType().FirstOrDefault(); + if (enableCors != null) + { + actionModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName)); + } + + disableCors = actionModel.Attributes.OfType().FirstOrDefault(); + if (disableCors != null) + { + actionModel.Filters.Add(new DisableCorsAuthorizationFilter()); + } + } + } + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/CorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsAuthorizationFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/CorsAuthorizationFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsAuthorizationFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/CorsAuthorizationFilterFactory.cs b/src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsAuthorizationFilterFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/CorsAuthorizationFilterFactory.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Cors/CorsAuthorizationFilterFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/DisableCorsAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Cors/DisableCorsAuthorizationFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/DisableCorsAuthorizationFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Cors/DisableCorsAuthorizationFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtActionResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/CreatedAtActionResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtActionResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/CreatedAtActionResult.cs index d6e5d72672..b6256f63b0 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtActionResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/CreatedAtActionResult.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.WebUtilities; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtRouteResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/CreatedAtRouteResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtRouteResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/CreatedAtRouteResult.cs index a510a10081..78efdb9f30 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedAtRouteResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/CreatedAtRouteResult.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.WebUtilities; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/CreatedResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/CreatedResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ExceptionFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ExceptionFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ExceptionFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ExceptionFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/FileContentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/FileContentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/FileContentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FileContentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/FilePathResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/FilePathResult.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/FilePathResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FilePathResult.cs index f3bddc4855..2d0edd7415 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/FilePathResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/FilePathResult.cs @@ -9,7 +9,7 @@ using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/FileResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/FileResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/FileResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FileResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/FileStreamResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/FileStreamResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/FileStreamResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FileStreamResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FormatFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/FormatFilter.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FormatFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/FormatFilter.cs index e519f4bb11..3f4992cfc5 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Filters/FormatFilter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Filters/FormatFilter.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Mvc /// /// The /// The - public FormatFilter(IOptions options, IScopedInstance actionContext) + public FormatFilter(IOptions options, IScopedInstance actionContext) { IsActive = true; Format = GetFormat(actionContext.Value); diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/FormatFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/FormatFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/FormatFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/FormatFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/IFormatFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/IFormatFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/IFormatFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/IFormatFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/IResponseCacheFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/IResponseCacheFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/IResponseCacheFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/IResponseCacheFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ProducesAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ProducesAttribute.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ProducesAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ProducesAttribute.cs index bd82f9e6c5..9c54e2924b 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Filters/ProducesAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ProducesAttribute.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Mvc.ApiExplorer; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheAttribute.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheAttribute.cs index c374f384cd..c0b5cf4ef0 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheAttribute.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; using Microsoft.Framework.OptionsModel; @@ -88,7 +88,7 @@ namespace Microsoft.AspNet.Mvc public IFilter CreateInstance([NotNull] IServiceProvider serviceProvider) { - var optionsAccessor = serviceProvider.GetRequiredService>(); + var optionsAccessor = serviceProvider.GetRequiredService>(); CacheProfile selectedProfile = null; if (CacheProfileName != null) diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheFilter.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheFilter.cs index ebe249a72b..eb09f0cf45 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Filters/ResponseCacheFilter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ResponseCacheFilter.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ResultFilterAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ResultFilterAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ResultFilterAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ResultFilterAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/SkipStatusCodePagesAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/SkipStatusCodePagesAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/SkipStatusCodePagesAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/SkipStatusCodePagesAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ValidateAntiForgeryTokenAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ValidateAntiForgeryTokenAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ValidateAntiForgeryTokenAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ValidateAntiForgeryTokenAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ValidateAntiForgeryTokenAuthorizationFilter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Filters/ValidateAntiForgeryTokenAuthorizationFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Filters/ValidateAntiForgeryTokenAuthorizationFilter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Filters/ValidateAntiForgeryTokenAuthorizationFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/FixedSetAssemblyProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/FixedSetAssemblyProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/FixedSetAssemblyProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FixedSetAssemblyProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/FixedSetControllerTypeProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/FixedSetControllerTypeProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/FixedSetControllerTypeProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FixedSetControllerTypeProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/FormContext.cs b/src/Microsoft.AspNet.Mvc.Extensions/FormContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/FormContext.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FormContext.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/FormatterMappings.cs b/src/Microsoft.AspNet.Mvc.Extensions/FormatterMappings.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/FormatterMappings.cs rename to src/Microsoft.AspNet.Mvc.Extensions/FormatterMappings.cs index ba5c6ad029..fc24ee5dfe 100644 --- a/src/Microsoft.AspNet.Mvc.Core/FormatterMappings.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/FormatterMappings.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/IJsonOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/IJsonOutputFormatter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/IJsonOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Formatters/IJsonOutputFormatter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs index b9e7c771c0..d3d9ce4971 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonInputFormatter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs @@ -5,7 +5,7 @@ using System; using System.IO; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core.Internal; +using Microsoft.AspNet.Mvc.Internal; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; using Newtonsoft.Json; diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/JsonOutputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs index 102fd5849a..3819da2799 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonOutputFormatter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core.Internal; using Microsoft.AspNet.Mvc.Internal; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; diff --git a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonPatchInputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonPatchInputFormatter.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/Formatters/JsonPatchInputFormatter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonPatchInputFormatter.cs index bcdd9f5a1a..c76b4fa941 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Formatters/JsonPatchInputFormatter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonPatchInputFormatter.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.JsonPatch; using Microsoft.Framework.Internal; using Microsoft.Net.Http.Headers; -using Microsoft.AspNet.Mvc.Core.Internal; +using Microsoft.AspNet.Mvc.Internal; using Newtonsoft.Json; namespace Microsoft.AspNet.Mvc diff --git a/src/Microsoft.AspNet.Mvc.Core/HiddenInputAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/HiddenInputAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/HiddenInputAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/HiddenInputAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpNotFoundObjectResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/HttpNotFoundObjectResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpNotFoundObjectResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/HttpNotFoundObjectResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpNotFoundResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/HttpNotFoundResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpNotFoundResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/HttpNotFoundResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpStatusCodeResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/HttpStatusCodeResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpStatusCodeResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/HttpStatusCodeResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpUnauthorizedResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/HttpUnauthorizedResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/HttpUnauthorizedResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/HttpUnauthorizedResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Internal/ModelClientValidationRemoteRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/Internal/ModelClientValidationRemoteRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Internal/ModelClientValidationRemoteRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Internal/ModelClientValidationRemoteRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Internal/SerializerSettingsProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/Internal/SerializerSettingsProvider.cs similarity index 92% rename from src/Microsoft.AspNet.Mvc.Core/Internal/SerializerSettingsProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Internal/SerializerSettingsProvider.cs index 86c416061b..297b0eb483 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Internal/SerializerSettingsProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Internal/SerializerSettingsProvider.cs @@ -3,12 +3,12 @@ using Newtonsoft.Json; -namespace Microsoft.AspNet.Mvc.Core.Internal +namespace Microsoft.AspNet.Mvc.Internal { /// /// Helper class which provides . /// - internal static class SerializerSettingsProvider + public static class SerializerSettingsProvider { private const int DefaultMaxDepth = 32; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/JsonResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/JsonResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/JsonResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/JsonResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Microsoft.AspNet.Mvc.Extensions.xproj b/src/Microsoft.AspNet.Mvc.Extensions/Microsoft.AspNet.Mvc.Extensions.xproj new file mode 100644 index 0000000000..d4e3794423 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Microsoft.AspNet.Mvc.Extensions.xproj @@ -0,0 +1,18 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + b2ca101a-87e6-4dd2-9bb2-28da68ef1a94 + Microsoft.AspNet.Mvc.Extensions + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompareAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/CompareAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompareAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/CompareAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidator.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsModelValidator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsModelValidator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataTypeAttributeAdapter.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataTypeAttributeAdapter.cs index e448f3943c..58c1dd0f80 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DataTypeAttributeAdapter.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding.Validation diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MaxLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/MaxLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MaxLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/MaxLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MinLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/MinLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MinLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/MinLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationEqualToRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationEqualToRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationEqualToRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationEqualToRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRangeRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRangeRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRangeRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRangeRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRegexRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRegexRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRegexRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRegexRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRequiredRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRequiredRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRequiredRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationRequiredRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RangeAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RangeAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RangeAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RangeAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RequiredAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RequiredAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RequiredAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/RequiredAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/StringLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/StringLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/StringLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/StringLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ValidatableObjectAdapter.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ValidatableObjectAdapter.cs index ead81f6cfe..7a58e41bb3 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ModelBinding/Validation/ValidatableObjectAdapter.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; namespace Microsoft.AspNet.Mvc.ModelBinding.Validation { diff --git a/src/Microsoft.AspNet.Mvc.Extensions/MvcCacheOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/MvcCacheOptions.cs new file mode 100644 index 0000000000..508ef98288 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/MvcCacheOptions.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.AspNet.Mvc +{ + /// + /// Provides programmatic configuration for caching in the MVC framework. + /// + public class MvcCacheOptions + { + /// + /// Gets a Dictionary of CacheProfile Names, which are pre-defined settings for + /// . + /// + public IDictionary CacheProfiles { get; } = + new Dictionary(StringComparer.OrdinalIgnoreCase); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Extensions/MvcFormatterMappingOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/MvcFormatterMappingOptions.cs new file mode 100644 index 0000000000..fe3c7bf121 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/MvcFormatterMappingOptions.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNet.Mvc +{ + /// + /// Provides programmatic configuration for formatter mappings in the MVC framework. + /// + public class MvcFormatterMappingOptions + { + /// + /// Used to specify mapping between the URL Format and corresponding + /// . + /// + public FormatterMappings FormatterMappings { get; } = new FormatterMappings(); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Extensions/MvcJsonOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/MvcJsonOptions.cs new file mode 100644 index 0000000000..e515944ac0 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/MvcJsonOptions.cs @@ -0,0 +1,19 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNet.Mvc.Internal; +using Newtonsoft.Json; + +namespace Microsoft.AspNet.Mvc +{ + /// + /// Provides programmatic configuration for JSON in the MVC framework. + /// + public class MvcJsonOptions + { + /// + /// Gets the that are used by this application. + /// + public JsonSerializerSettings SerializerSettings { get; } = SerializerSettingsProvider.CreateSerializerSettings(); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Extensions/MvcViewOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/MvcViewOptions.cs new file mode 100644 index 0000000000..a7fdec120b --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/MvcViewOptions.cs @@ -0,0 +1,33 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using Microsoft.AspNet.Mvc.ModelBinding.Validation; +using Microsoft.AspNet.Mvc.Rendering; +using Microsoft.Framework.Internal; + +namespace Microsoft.AspNet.Mvc +{ + /// + /// Provides programmatic configuration for views in the MVC framework. + /// + public class MvcViewOptions + { + /// + /// Gets or sets programmatic configuration for the HTML helpers and . + /// + public HtmlHelperOptions HtmlHelperOptions { get;[param: NotNull] set; } = new HtmlHelperOptions(); + + /// + /// Gets a list of descriptors that represent used + /// by this application. + /// + public IList ViewEngines { get; } = new List(); + + /// + /// Gets a list of instances. + /// + public IList ClientModelValidatorProviders { get; } = + new List(); + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/NoContentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/NoContentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/NoContentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/NoContentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/PartialViewResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/PartialViewResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/PartialViewResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/PartialViewResult.cs index 964c5bd1d4..c66dfd131e 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/PartialViewResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/PartialViewResult.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Mvc var logger = context.HttpContext.RequestServices.GetRequiredService>(); - var options = context.HttpContext.RequestServices.GetRequiredService>(); + var options = context.HttpContext.RequestServices.GetRequiredService>(); var viewName = ViewName ?? context.ActionDescriptor.Name; var viewEngineResult = viewEngine.FindPartialView(context, viewName); diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Mvc.Extensions/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..29a0c259be --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Extensions.Test")] +[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Razor.Test")] +[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.TagHelpers.Test")] +[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Xml.Test")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +[assembly: AssemblyMetadata("Serviceable", "True")] diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Mvc.Extensions/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..8ae8c62618 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Properties/Resources.Designer.cs @@ -0,0 +1,2094 @@ +// +namespace Microsoft.AspNet.Mvc.Extensions +{ + using System.Globalization; + using System.Reflection; + using System.Resources; + + internal static class Resources + { + private static readonly ResourceManager _resourceManager + = new ResourceManager("Microsoft.AspNet.Mvc.Extensions.Resources", typeof(Resources).GetTypeInfo().Assembly); + + /// + /// The argument '{0}' is invalid. Media types which match all types or match all subtypes are not supported. + /// + internal static string MatchAllContentTypeIsNotAllowed + { + get { return GetString("MatchAllContentTypeIsNotAllowed"); } + } + + /// + /// The argument '{0}' is invalid. Media types which match all types or match all subtypes are not supported. + /// + internal static string FormatMatchAllContentTypeIsNotAllowed(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("MatchAllContentTypeIsNotAllowed"), p0); + } + + /// + /// The content-type '{0}' added in the '{1}' property is invalid. Media types which match all types or match all subtypes are not supported. + /// + internal static string ObjectResult_MatchAllContentType + { + get { return GetString("ObjectResult_MatchAllContentType"); } + } + + /// + /// The content-type '{0}' added in the '{1}' property is invalid. Media types which match all types or match all subtypes are not supported. + /// + internal static string FormatObjectResult_MatchAllContentType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ObjectResult_MatchAllContentType"), p0, p1); + } + + /// + /// The provided anti-forgery token failed a custom data check. + /// + internal static string AntiForgeryToken_AdditionalDataCheckFailed + { + get { return GetString("AntiForgeryToken_AdditionalDataCheckFailed"); } + } + + /// + /// The provided anti-forgery token failed a custom data check. + /// + internal static string FormatAntiForgeryToken_AdditionalDataCheckFailed() + { + return GetString("AntiForgeryToken_AdditionalDataCheckFailed"); + } + + /// + /// The provided anti-forgery token was meant for a different claims-based user than the current user. + /// + internal static string AntiForgeryToken_ClaimUidMismatch + { + get { return GetString("AntiForgeryToken_ClaimUidMismatch"); } + } + + /// + /// The provided anti-forgery token was meant for a different claims-based user than the current user. + /// + internal static string FormatAntiForgeryToken_ClaimUidMismatch() + { + return GetString("AntiForgeryToken_ClaimUidMismatch"); + } + + /// + /// The required anti-forgery cookie "{0}" is not present. + /// + internal static string AntiForgeryToken_CookieMissing + { + get { return GetString("AntiForgeryToken_CookieMissing"); } + } + + /// + /// The required anti-forgery cookie "{0}" is not present. + /// + internal static string FormatAntiForgeryToken_CookieMissing(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AntiForgeryToken_CookieMissing"), p0); + } + + /// + /// The anti-forgery token could not be decrypted. + /// + internal static string AntiForgeryToken_DeserializationFailed + { + get { return GetString("AntiForgeryToken_DeserializationFailed"); } + } + + /// + /// The anti-forgery token could not be decrypted. + /// + internal static string FormatAntiForgeryToken_DeserializationFailed() + { + return GetString("AntiForgeryToken_DeserializationFailed"); + } + + /// + /// The required anti-forgery form field "{0}" is not present. + /// + internal static string AntiForgeryToken_FormFieldMissing + { + get { return GetString("AntiForgeryToken_FormFieldMissing"); } + } + + /// + /// The required anti-forgery form field "{0}" is not present. + /// + internal static string FormatAntiForgeryToken_FormFieldMissing(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AntiForgeryToken_FormFieldMissing"), p0); + } + + /// + /// The anti-forgery cookie token and form field token do not match. + /// + internal static string AntiForgeryToken_SecurityTokenMismatch + { + get { return GetString("AntiForgeryToken_SecurityTokenMismatch"); } + } + + /// + /// The anti-forgery cookie token and form field token do not match. + /// + internal static string FormatAntiForgeryToken_SecurityTokenMismatch() + { + return GetString("AntiForgeryToken_SecurityTokenMismatch"); + } + + /// + /// Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped. + /// + internal static string AntiForgeryToken_TokensSwapped + { + get { return GetString("AntiForgeryToken_TokensSwapped"); } + } + + /// + /// Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped. + /// + internal static string FormatAntiForgeryToken_TokensSwapped(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AntiForgeryToken_TokensSwapped"), p0, p1); + } + + /// + /// The provided anti-forgery token was meant for user "{0}", but the current user is "{1}". + /// + internal static string AntiForgeryToken_UsernameMismatch + { + get { return GetString("AntiForgeryToken_UsernameMismatch"); } + } + + /// + /// The provided anti-forgery token was meant for user "{0}", but the current user is "{1}". + /// + internal static string FormatAntiForgeryToken_UsernameMismatch(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AntiForgeryToken_UsernameMismatch"), p0, p1); + } + + /// + /// The anti-forgery system has the configuration value AntiForgeryOptions.RequireSsl = true, but the current request is not an SSL request. + /// + internal static string AntiForgeryWorker_RequireSSL + { + get { return GetString("AntiForgeryWorker_RequireSSL"); } + } + + /// + /// The anti-forgery system has the configuration value AntiForgeryOptions.RequireSsl = true, but the current request is not an SSL request. + /// + internal static string FormatAntiForgeryWorker_RequireSSL() + { + return GetString("AntiForgeryWorker_RequireSSL"); + } + + /// + /// The method '{0}' on type '{1}' returned an instance of '{2}'. Make sure to call Unwrap on the returned value to avoid unobserved faulted Task. + /// + internal static string ActionExecutor_WrappedTaskInstance + { + get { return GetString("ActionExecutor_WrappedTaskInstance"); } + } + + /// + /// The method '{0}' on type '{1}' returned an instance of '{2}'. Make sure to call Unwrap on the returned value to avoid unobserved faulted Task. + /// + internal static string FormatActionExecutor_WrappedTaskInstance(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ActionExecutor_WrappedTaskInstance"), p0, p1, p2); + } + + /// + /// The method '{0}' on type '{1}' returned a Task instance even though it is not an asynchronous method. + /// + internal static string ActionExecutor_UnexpectedTaskInstance + { + get { return GetString("ActionExecutor_UnexpectedTaskInstance"); } + } + + /// + /// The method '{0}' on type '{1}' returned a Task instance even though it is not an asynchronous method. + /// + internal static string FormatActionExecutor_UnexpectedTaskInstance(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ActionExecutor_UnexpectedTaskInstance"), p0, p1); + } + + /// + /// A claim of type '{0}' was not present on the provided ClaimsIdentity. + /// + internal static string ClaimUidExtractor_ClaimNotPresent + { + get { return GetString("ClaimUidExtractor_ClaimNotPresent"); } + } + + /// + /// A claim of type '{0}' was not present on the provided ClaimsIdentity. + /// + internal static string FormatClaimUidExtractor_ClaimNotPresent(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ClaimUidExtractor_ClaimNotPresent"), p0); + } + + /// + /// The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user. + /// + internal static string TokenValidator_AuthenticatedUserWithoutUsername + { + get { return GetString("TokenValidator_AuthenticatedUserWithoutUsername"); } + } + + /// + /// The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user. + /// + internal static string FormatTokenValidator_AuthenticatedUserWithoutUsername(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TokenValidator_AuthenticatedUserWithoutUsername"), p0); + } + + /// + /// The class ReflectedActionFilterEndPoint only supports ReflectedActionDescriptors. + /// + internal static string ReflectedActionFilterEndPoint_UnexpectedActionDescriptor + { + get { return GetString("ReflectedActionFilterEndPoint_UnexpectedActionDescriptor"); } + } + + /// + /// The class ReflectedActionFilterEndPoint only supports ReflectedActionDescriptors. + /// + internal static string FormatReflectedActionFilterEndPoint_UnexpectedActionDescriptor() + { + return GetString("ReflectedActionFilterEndPoint_UnexpectedActionDescriptor"); + } + + /// + /// The view component name '{0}' matched multiple types:{1}{2} + /// + internal static string ViewComponent_AmbiguousTypeMatch + { + get { return GetString("ViewComponent_AmbiguousTypeMatch"); } + } + + /// + /// The view component name '{0}' matched multiple types:{1}{2} + /// + internal static string FormatViewComponent_AmbiguousTypeMatch(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_AmbiguousTypeMatch"), p0, p1, p2); + } + + /// + /// The async view component method '{0}' should be declared to return Task<T>. + /// + internal static string ViewComponent_AsyncMethod_ShouldReturnTask + { + get { return GetString("ViewComponent_AsyncMethod_ShouldReturnTask"); } + } + + /// + /// The async view component method '{0}' should be declared to return Task<T>. + /// + internal static string FormatViewComponent_AsyncMethod_ShouldReturnTask(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_AsyncMethod_ShouldReturnTask"), p0); + } + + /// + /// A view component must return a non-null value. + /// + internal static string ViewComponent_MustReturnValue + { + get { return GetString("ViewComponent_MustReturnValue"); } + } + + /// + /// A view component must return a non-null value. + /// + internal static string FormatViewComponent_MustReturnValue() + { + return GetString("ViewComponent_MustReturnValue"); + } + + /// + /// The view component method '{0}' should be declared to return a value. + /// + internal static string ViewComponent_SyncMethod_ShouldReturnValue + { + get { return GetString("ViewComponent_SyncMethod_ShouldReturnValue"); } + } + + /// + /// The view component method '{0}' should be declared to return a value. + /// + internal static string FormatViewComponent_SyncMethod_ShouldReturnValue(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_SyncMethod_ShouldReturnValue"), p0); + } + + /// + /// A view component named '{0}' could not be found. + /// + internal static string ViewComponent_CannotFindComponent + { + get { return GetString("ViewComponent_CannotFindComponent"); } + } + + /// + /// A view component named '{0}' could not be found. + /// + internal static string FormatViewComponent_CannotFindComponent(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_CannotFindComponent"), p0); + } + + /// + /// An invoker could not be created for the view component '{0}'. + /// + internal static string ViewComponent_IViewComponentFactory_ReturnedNull + { + get { return GetString("ViewComponent_IViewComponentFactory_ReturnedNull"); } + } + + /// + /// An invoker could not be created for the view component '{0}'. + /// + internal static string FormatViewComponent_IViewComponentFactory_ReturnedNull(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_IViewComponentFactory_ReturnedNull"), p0); + } + + /// + /// Could not find an '{0}' method matching the parameters. + /// + internal static string ViewComponent_CannotFindMethod + { + get { return GetString("ViewComponent_CannotFindMethod"); } + } + + /// + /// Could not find an '{0}' method matching the parameters. + /// + internal static string FormatViewComponent_CannotFindMethod(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_CannotFindMethod"), p0); + } + + /// + /// Could not find an '{0}' or '{1}' method matching the parameters. + /// + internal static string ViewComponent_CannotFindMethod_WithFallback + { + get { return GetString("ViewComponent_CannotFindMethod_WithFallback"); } + } + + /// + /// Could not find an '{0}' or '{1}' method matching the parameters. + /// + internal static string FormatViewComponent_CannotFindMethod_WithFallback(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_CannotFindMethod_WithFallback"), p0, p1); + } + + /// + /// View components only support returning {0}, {1} or {2}. + /// + internal static string ViewComponent_InvalidReturnValue + { + get { return GetString("ViewComponent_InvalidReturnValue"); } + } + + /// + /// View components only support returning {0}, {1} or {2}. + /// + internal static string FormatViewComponent_InvalidReturnValue(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_InvalidReturnValue"), p0, p1, p2); + } + + /// + /// Replacing the action context is not supported. + /// + internal static string ActionContextAccessor_SetValueNotSupported + { + get { return GetString("ActionContextAccessor_SetValueNotSupported"); } + } + + /// + /// Replacing the action context is not supported. + /// + internal static string FormatActionContextAccessor_SetValueNotSupported() + { + return GetString("ActionContextAccessor_SetValueNotSupported"); + } + + /// + /// An action invoker could not be created for action '{0}'. + /// + internal static string ActionInvokerFactory_CouldNotCreateInvoker + { + get { return GetString("ActionInvokerFactory_CouldNotCreateInvoker"); } + } + + /// + /// An action invoker could not be created for action '{0}'. + /// + internal static string FormatActionInvokerFactory_CouldNotCreateInvoker(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ActionInvokerFactory_CouldNotCreateInvoker"), p0); + } + + /// + /// The action descriptor must be of type '{0}'. + /// + internal static string ActionDescriptorMustBeBasedOnControllerAction + { + get { return GetString("ActionDescriptorMustBeBasedOnControllerAction"); } + } + + /// + /// The action descriptor must be of type '{0}'. + /// + internal static string FormatActionDescriptorMustBeBasedOnControllerAction(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ActionDescriptorMustBeBasedOnControllerAction"), p0); + } + + /// + /// Value cannot be null or empty. + /// + internal static string ArgumentCannotBeNullOrEmpty + { + get { return GetString("ArgumentCannotBeNullOrEmpty"); } + } + + /// + /// Value cannot be null or empty. + /// + internal static string FormatArgumentCannotBeNullOrEmpty() + { + return GetString("ArgumentCannotBeNullOrEmpty"); + } + + /// + /// The '{0}' property of '{1}' must not be null. + /// + internal static string PropertyOfTypeCannotBeNull + { + get { return GetString("PropertyOfTypeCannotBeNull"); } + } + + /// + /// The '{0}' property of '{1}' must not be null. + /// + internal static string FormatPropertyOfTypeCannotBeNull(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("PropertyOfTypeCannotBeNull"), p0, p1); + } + + /// + /// The '{0}' method of type '{1}' cannot return a null value. + /// + internal static string TypeMethodMustReturnNotNullValue + { + get { return GetString("TypeMethodMustReturnNotNullValue"); } + } + + /// + /// The '{0}' method of type '{1}' cannot return a null value. + /// + internal static string FormatTypeMethodMustReturnNotNullValue(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TypeMethodMustReturnNotNullValue"), p0, p1); + } + + /// + /// The supplied route values are ambiguous and can select multiple sets of actions. + /// + internal static string ActionSelector_GetCandidateActionsIsAmbiguous + { + get { return GetString("ActionSelector_GetCandidateActionsIsAmbiguous"); } + } + + /// + /// The supplied route values are ambiguous and can select multiple sets of actions. + /// + internal static string FormatActionSelector_GetCandidateActionsIsAmbiguous() + { + return GetString("ActionSelector_GetCandidateActionsIsAmbiguous"); + } + + /// + /// Property '{0}' is of type '{1}', but this method requires a value of type '{2}'. + /// + internal static string ArgumentPropertyUnexpectedType + { + get { return GetString("ArgumentPropertyUnexpectedType"); } + } + + /// + /// Property '{0}' is of type '{1}', but this method requires a value of type '{2}'. + /// + internal static string FormatArgumentPropertyUnexpectedType(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ArgumentPropertyUnexpectedType"), p0, p1, p2); + } + + /// + /// The partial view '{0}' was not found or no view engine supports the searched locations. The following locations were searched:{1} + /// + internal static string Common_PartialViewNotFound + { + get { return GetString("Common_PartialViewNotFound"); } + } + + /// + /// The partial view '{0}' was not found or no view engine supports the searched locations. The following locations were searched:{1} + /// + internal static string FormatCommon_PartialViewNotFound(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Common_PartialViewNotFound"), p0, p1); + } + + /// + /// The value '{0}' is invalid. + /// + internal static string Common_ValueNotValidForProperty + { + get { return GetString("Common_ValueNotValidForProperty"); } + } + + /// + /// The value '{0}' is invalid. + /// + internal static string FormatCommon_ValueNotValidForProperty(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Common_ValueNotValidForProperty"), p0); + } + + /// + /// False + /// + internal static string Common_TriState_False + { + get { return GetString("Common_TriState_False"); } + } + + /// + /// False + /// + internal static string FormatCommon_TriState_False() + { + return GetString("Common_TriState_False"); + } + + /// + /// Not Set + /// + internal static string Common_TriState_NotSet + { + get { return GetString("Common_TriState_NotSet"); } + } + + /// + /// Not Set + /// + internal static string FormatCommon_TriState_NotSet() + { + return GetString("Common_TriState_NotSet"); + } + + /// + /// True + /// + internal static string Common_TriState_True + { + get { return GetString("Common_TriState_True"); } + } + + /// + /// True + /// + internal static string FormatCommon_TriState_True() + { + return GetString("Common_TriState_True"); + } + + /// + /// ViewData value must not be null. + /// + internal static string DynamicViewData_ViewDataNull + { + get { return GetString("DynamicViewData_ViewDataNull"); } + } + + /// + /// ViewData value must not be null. + /// + internal static string FormatDynamicViewData_ViewDataNull() + { + return GetString("DynamicViewData_ViewDataNull"); + } + + /// + /// The expression compiler was unable to evaluate the indexer expression '{0}' because it references the model parameter '{1}' which is unavailable. + /// + internal static string ExpressionHelper_InvalidIndexerExpression + { + get { return GetString("ExpressionHelper_InvalidIndexerExpression"); } + } + + /// + /// The expression compiler was unable to evaluate the indexer expression '{0}' because it references the model parameter '{1}' which is unavailable. + /// + internal static string FormatExpressionHelper_InvalidIndexerExpression(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ExpressionHelper_InvalidIndexerExpression"), p0, p1); + } + + /// + /// The passed expression of expression node type '{0}' is invalid. Only simple member access expressions for model properties are supported. + /// + internal static string Invalid_IncludePropertyExpression + { + get { return GetString("Invalid_IncludePropertyExpression"); } + } + + /// + /// The passed expression of expression node type '{0}' is invalid. Only simple member access expressions for model properties are supported. + /// + internal static string FormatInvalid_IncludePropertyExpression(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Invalid_IncludePropertyExpression"), p0); + } + + /// + /// The IModelMetadataProvider was unable to provide metadata for expression '{0}'. + /// + internal static string HtmlHelper_NullModelMetadata + { + get { return GetString("HtmlHelper_NullModelMetadata"); } + } + + /// + /// The IModelMetadataProvider was unable to provide metadata for expression '{0}'. + /// + internal static string FormatHtmlHelper_NullModelMetadata(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("HtmlHelper_NullModelMetadata"), p0); + } + + /// + /// Must call 'Contextualize' method before using this HtmlHelper instance. + /// + internal static string HtmlHelper_NotContextualized + { + get { return GetString("HtmlHelper_NotContextualized"); } + } + + /// + /// Must call 'Contextualize' method before using this HtmlHelper instance. + /// + internal static string FormatHtmlHelper_NotContextualized() + { + return GetString("HtmlHelper_NotContextualized"); + } + + /// + /// There is no ViewData item of type '{0}' that has the key '{1}'. + /// + internal static string HtmlHelper_MissingSelectData + { + get { return GetString("HtmlHelper_MissingSelectData"); } + } + + /// + /// There is no ViewData item of type '{0}' that has the key '{1}'. + /// + internal static string FormatHtmlHelper_MissingSelectData(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("HtmlHelper_MissingSelectData"), p0, p1); + } + + /// + /// The parameter '{0}' must evaluate to an IEnumerable when multiple selection is allowed. + /// + internal static string HtmlHelper_SelectExpressionNotEnumerable + { + get { return GetString("HtmlHelper_SelectExpressionNotEnumerable"); } + } + + /// + /// The parameter '{0}' must evaluate to an IEnumerable when multiple selection is allowed. + /// + internal static string FormatHtmlHelper_SelectExpressionNotEnumerable(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("HtmlHelper_SelectExpressionNotEnumerable"), p0); + } + + /// + /// The type '{0}' is not supported. Type must be an {1} that does not have an associated {2}. + /// + internal static string HtmlHelper_TypeNotSupported_ForGetEnumSelectList + { + get { return GetString("HtmlHelper_TypeNotSupported_ForGetEnumSelectList"); } + } + + /// + /// The type '{0}' is not supported. Type must be an {1} that does not have an associated {2}. + /// + internal static string FormatHtmlHelper_TypeNotSupported_ForGetEnumSelectList(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("HtmlHelper_TypeNotSupported_ForGetEnumSelectList"), p0, p1, p2); + } + + /// + /// The ViewData item that has the key '{0}' is of type '{1}' but must be of type '{2}'. + /// + internal static string HtmlHelper_WrongSelectDataType + { + get { return GetString("HtmlHelper_WrongSelectDataType"); } + } + + /// + /// The ViewData item that has the key '{0}' is of type '{1}' but must be of type '{2}'. + /// + internal static string FormatHtmlHelper_WrongSelectDataType(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("HtmlHelper_WrongSelectDataType"), p0, p1, p2); + } + + /// + /// The '{0}' template was used with an object of type '{1}', which does not implement '{2}'. + /// + internal static string Templates_TypeMustImplementIEnumerable + { + get { return GetString("Templates_TypeMustImplementIEnumerable"); } + } + + /// + /// The '{0}' template was used with an object of type '{1}', which does not implement '{2}'. + /// + internal static string FormatTemplates_TypeMustImplementIEnumerable(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Templates_TypeMustImplementIEnumerable"), p0, p1, p2); + } + + /// + /// Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions. + /// + internal static string TemplateHelpers_TemplateLimitations + { + get { return GetString("TemplateHelpers_TemplateLimitations"); } + } + + /// + /// Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions. + /// + internal static string FormatTemplateHelpers_TemplateLimitations() + { + return GetString("TemplateHelpers_TemplateLimitations"); + } + + /// + /// Unable to locate an appropriate template for type {0}. + /// + internal static string TemplateHelpers_NoTemplate + { + get { return GetString("TemplateHelpers_NoTemplate"); } + } + + /// + /// Unable to locate an appropriate template for type {0}. + /// + internal static string FormatTemplateHelpers_NoTemplate(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TemplateHelpers_NoTemplate"), p0); + } + + /// + /// The model item passed is null, but this ViewDataDictionary instance requires a non-null model item of type '{0}'. + /// + internal static string ViewData_ModelCannotBeNull + { + get { return GetString("ViewData_ModelCannotBeNull"); } + } + + /// + /// The model item passed is null, but this ViewDataDictionary instance requires a non-null model item of type '{0}'. + /// + internal static string FormatViewData_ModelCannotBeNull(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewData_ModelCannotBeNull"), p0); + } + + /// + /// The model item passed into the ViewDataDictionary is of type '{0}', but this ViewDataDictionary instance requires a model item of type '{1}'. + /// + internal static string ViewData_WrongTModelType + { + get { return GetString("ViewData_WrongTModelType"); } + } + + /// + /// The model item passed into the ViewDataDictionary is of type '{0}', but this ViewDataDictionary instance requires a model item of type '{1}'. + /// + internal static string FormatViewData_WrongTModelType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewData_WrongTModelType"), p0, p1); + } + + /// + /// No route matches the supplied values. + /// + internal static string NoRoutesMatched + { + get { return GetString("NoRoutesMatched"); } + } + + /// + /// No route matches the supplied values. + /// + internal static string FormatNoRoutesMatched() + { + return GetString("NoRoutesMatched"); + } + + /// + /// If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + /// + internal static string AsyncActionFilter_InvalidShortCircuit + { + get { return GetString("AsyncActionFilter_InvalidShortCircuit"); } + } + + /// + /// If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + /// + internal static string FormatAsyncActionFilter_InvalidShortCircuit(object p0, object p1, object p2, object p3) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AsyncActionFilter_InvalidShortCircuit"), p0, p1, p2, p3); + } + + /// + /// If an {0} cancels execution by setting the {1} property of {2} to 'true', then it cannot call the next filter by invoking {3}. + /// + internal static string AsyncResultFilter_InvalidShortCircuit + { + get { return GetString("AsyncResultFilter_InvalidShortCircuit"); } + } + + /// + /// If an {0} cancels execution by setting the {1} property of {2} to 'true', then it cannot call the next filter by invoking {3}. + /// + internal static string FormatAsyncResultFilter_InvalidShortCircuit(object p0, object p1, object p2, object p3) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AsyncResultFilter_InvalidShortCircuit"), p0, p1, p2, p3); + } + + /// + /// The partial view '{0}' was not found. The following locations were searched:{1} + /// + internal static string ViewEngine_PartialViewNotFound + { + get { return GetString("ViewEngine_PartialViewNotFound"); } + } + + /// + /// The partial view '{0}' was not found. The following locations were searched:{1} + /// + internal static string FormatViewEngine_PartialViewNotFound(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewEngine_PartialViewNotFound"), p0, p1); + } + + /// + /// The view '{0}' was not found. The following locations were searched:{1}. + /// + internal static string ViewEngine_ViewNotFound + { + get { return GetString("ViewEngine_ViewNotFound"); } + } + + /// + /// The view '{0}' was not found. The following locations were searched:{1}. + /// + internal static string FormatViewEngine_ViewNotFound(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewEngine_ViewNotFound"), p0, p1); + } + + /// + /// Unable to locate an implementation of IAuthorizationService. + /// + internal static string AuthorizeAttribute_AuthorizationServiceMustBeDefined + { + get { return GetString("AuthorizeAttribute_AuthorizationServiceMustBeDefined"); } + } + + /// + /// Unable to locate an implementation of IAuthorizationService. + /// + internal static string FormatAuthorizeAttribute_AuthorizationServiceMustBeDefined() + { + return GetString("AuthorizeAttribute_AuthorizationServiceMustBeDefined"); + } + + /// + /// OnAuthorization is not implemented by this filter, use OnAuthorizationAsync instead. + /// + internal static string AuthorizeAttribute_OnAuthorizationNotImplemented + { + get { return GetString("AuthorizeAttribute_OnAuthorizationNotImplemented"); } + } + + /// + /// OnAuthorization is not implemented by this filter, use OnAuthorizationAsync instead. + /// + internal static string FormatAuthorizeAttribute_OnAuthorizationNotImplemented() + { + return GetString("AuthorizeAttribute_OnAuthorizationNotImplemented"); + } + + /// + /// The value must be greater than or equal to zero. + /// + internal static string HtmlHelper_TextAreaParameterOutOfRange + { + get { return GetString("HtmlHelper_TextAreaParameterOutOfRange"); } + } + + /// + /// The value must be greater than or equal to zero. + /// + internal static string FormatHtmlHelper_TextAreaParameterOutOfRange() + { + return GetString("HtmlHelper_TextAreaParameterOutOfRange"); + } + + /// + /// The type provided to '{0}' must implement '{1}'. + /// + internal static string FilterFactoryAttribute_TypeMustImplementIFilter + { + get { return GetString("FilterFactoryAttribute_TypeMustImplementIFilter"); } + } + + /// + /// The type provided to '{0}' must implement '{1}'. + /// + internal static string FormatFilterFactoryAttribute_TypeMustImplementIFilter(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("FilterFactoryAttribute_TypeMustImplementIFilter"), p0, p1); + } + + /// + /// Validation parameter names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + /// + internal static string UnobtrusiveJavascript_ValidationParameterCannotBeEmpty + { + get { return GetString("UnobtrusiveJavascript_ValidationParameterCannotBeEmpty"); } + } + + /// + /// Validation parameter names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + /// + internal static string FormatUnobtrusiveJavascript_ValidationParameterCannotBeEmpty(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnobtrusiveJavascript_ValidationParameterCannotBeEmpty"), p0); + } + + /// + /// Validation parameter names in unobtrusive client validation rules must start with a lowercase letter and consist of only lowercase letters or digits. Validation parameter name: {0}, client rule type: {1} + /// + internal static string UnobtrusiveJavascript_ValidationParameterMustBeLegal + { + get { return GetString("UnobtrusiveJavascript_ValidationParameterMustBeLegal"); } + } + + /// + /// Validation parameter names in unobtrusive client validation rules must start with a lowercase letter and consist of only lowercase letters or digits. Validation parameter name: {0}, client rule type: {1} + /// + internal static string FormatUnobtrusiveJavascript_ValidationParameterMustBeLegal(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnobtrusiveJavascript_ValidationParameterMustBeLegal"), p0, p1); + } + + /// + /// Validation type names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + /// + internal static string UnobtrusiveJavascript_ValidationTypeCannotBeEmpty + { + get { return GetString("UnobtrusiveJavascript_ValidationTypeCannotBeEmpty"); } + } + + /// + /// Validation type names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + /// + internal static string FormatUnobtrusiveJavascript_ValidationTypeCannotBeEmpty(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnobtrusiveJavascript_ValidationTypeCannotBeEmpty"), p0); + } + + /// + /// Validation type names in unobtrusive client validation rules must consist of only lowercase letters. Invalid name: "{0}", client rule type: {1} + /// + internal static string UnobtrusiveJavascript_ValidationTypeMustBeLegal + { + get { return GetString("UnobtrusiveJavascript_ValidationTypeMustBeLegal"); } + } + + /// + /// Validation type names in unobtrusive client validation rules must consist of only lowercase letters. Invalid name: "{0}", client rule type: {1} + /// + internal static string FormatUnobtrusiveJavascript_ValidationTypeMustBeLegal(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnobtrusiveJavascript_ValidationTypeMustBeLegal"), p0, p1); + } + + /// + /// Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: {0} + /// + internal static string UnobtrusiveJavascript_ValidationTypeMustBeUnique + { + get { return GetString("UnobtrusiveJavascript_ValidationTypeMustBeUnique"); } + } + + /// + /// Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: {0} + /// + internal static string FormatUnobtrusiveJavascript_ValidationTypeMustBeUnique(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnobtrusiveJavascript_ValidationTypeMustBeUnique"), p0); + } + + /// + /// Cannot return null from an action method with a return type of '{0}'. + /// + internal static string ActionResult_ActionReturnValueCannotBeNull + { + get { return GetString("ActionResult_ActionReturnValueCannotBeNull"); } + } + + /// + /// Cannot return null from an action method with a return type of '{0}'. + /// + internal static string FormatActionResult_ActionReturnValueCannotBeNull(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ActionResult_ActionReturnValueCannotBeNull"), p0); + } + + /// + /// The type '{0}' must derive from '{1}'. + /// + internal static string TypeMustDeriveFromType + { + get { return GetString("TypeMustDeriveFromType"); } + } + + /// + /// The type '{0}' must derive from '{1}'. + /// + internal static string FormatTypeMustDeriveFromType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TypeMustDeriveFromType"), p0, p1); + } + + /// + /// No encoding found for output formatter '{0}'. There must be at least one supported encoding registered in order for the output formatter to write content. + /// + internal static string OutputFormatterNoEncoding + { + get { return GetString("OutputFormatterNoEncoding"); } + } + + /// + /// No encoding found for output formatter '{0}'. There must be at least one supported encoding registered in order for the output formatter to write content. + /// + internal static string FormatOutputFormatterNoEncoding(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("OutputFormatterNoEncoding"), p0); + } + + /// + /// No encoding found for input formatter '{0}'. There must be at least one supported encoding registered in order for the formatter to read content. + /// + internal static string InputFormatterNoEncoding + { + get { return GetString("InputFormatterNoEncoding"); } + } + + /// + /// No encoding found for input formatter '{0}'. There must be at least one supported encoding registered in order for the formatter to read content. + /// + internal static string FormatInputFormatterNoEncoding(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("InputFormatterNoEncoding"), p0); + } + + /// + /// Unsupported content type '{0}'. + /// + internal static string UnsupportedContentType + { + get { return GetString("UnsupportedContentType"); } + } + + /// + /// Unsupported content type '{0}'. + /// + internal static string FormatUnsupportedContentType(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnsupportedContentType"), p0); + } + + /// + /// No supported media type registered for output formatter '{0}'. There must be at least one supported media type registered in order for the output formatter to write content. + /// + internal static string OutputFormatterNoMediaType + { + get { return GetString("OutputFormatterNoMediaType"); } + } + + /// + /// No supported media type registered for output formatter '{0}'. There must be at least one supported media type registered in order for the output formatter to write content. + /// + internal static string FormatOutputFormatterNoMediaType(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("OutputFormatterNoMediaType"), p0); + } + + /// + /// The following errors occurred with attribute routing information:{0}{0}{1} + /// + internal static string AttributeRoute_AggregateErrorMessage + { + get { return GetString("AttributeRoute_AggregateErrorMessage"); } + } + + /// + /// The following errors occurred with attribute routing information:{0}{0}{1} + /// + internal static string FormatAttributeRoute_AggregateErrorMessage(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_AggregateErrorMessage"), p0, p1); + } + + /// + /// The attribute route '{0}' cannot contain a parameter named '{{{1}}}'. Use '[{1}]' in the route template to insert the value '{2}'. + /// + internal static string AttributeRoute_CannotContainParameter + { + get { return GetString("AttributeRoute_CannotContainParameter"); } + } + + /// + /// The attribute route '{0}' cannot contain a parameter named '{{{1}}}'. Use '[{1}]' in the route template to insert the value '{2}'. + /// + internal static string FormatAttributeRoute_CannotContainParameter(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_CannotContainParameter"), p0, p1, p2); + } + + /// + /// For action: '{0}'{1}Error: {2} + /// + internal static string AttributeRoute_IndividualErrorMessage + { + get { return GetString("AttributeRoute_IndividualErrorMessage"); } + } + + /// + /// For action: '{0}'{1}Error: {2} + /// + internal static string FormatAttributeRoute_IndividualErrorMessage(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_IndividualErrorMessage"), p0, p1, p2); + } + + /// + /// An empty replacement token ('[]') is not allowed. + /// + internal static string AttributeRoute_TokenReplacement_EmptyTokenNotAllowed + { + get { return GetString("AttributeRoute_TokenReplacement_EmptyTokenNotAllowed"); } + } + + /// + /// An empty replacement token ('[]') is not allowed. + /// + internal static string FormatAttributeRoute_TokenReplacement_EmptyTokenNotAllowed() + { + return GetString("AttributeRoute_TokenReplacement_EmptyTokenNotAllowed"); + } + + /// + /// Token delimiters ('[', ']') are imbalanced. + /// + internal static string AttributeRoute_TokenReplacement_ImbalancedSquareBrackets + { + get { return GetString("AttributeRoute_TokenReplacement_ImbalancedSquareBrackets"); } + } + + /// + /// Token delimiters ('[', ']') are imbalanced. + /// + internal static string FormatAttributeRoute_TokenReplacement_ImbalancedSquareBrackets() + { + return GetString("AttributeRoute_TokenReplacement_ImbalancedSquareBrackets"); + } + + /// + /// The route template '{0}' has invalid syntax. {1} + /// + internal static string AttributeRoute_TokenReplacement_InvalidSyntax + { + get { return GetString("AttributeRoute_TokenReplacement_InvalidSyntax"); } + } + + /// + /// The route template '{0}' has invalid syntax. {1} + /// + internal static string FormatAttributeRoute_TokenReplacement_InvalidSyntax(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_TokenReplacement_InvalidSyntax"), p0, p1); + } + + /// + /// While processing template '{0}', a replacement value for the token '{1}' could not be found. Available tokens: '{2}'. + /// + internal static string AttributeRoute_TokenReplacement_ReplacementValueNotFound + { + get { return GetString("AttributeRoute_TokenReplacement_ReplacementValueNotFound"); } + } + + /// + /// While processing template '{0}', a replacement value for the token '{1}' could not be found. Available tokens: '{2}'. + /// + internal static string FormatAttributeRoute_TokenReplacement_ReplacementValueNotFound(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_TokenReplacement_ReplacementValueNotFound"), p0, p1, p2); + } + + /// + /// A replacement token is not closed. + /// + internal static string AttributeRoute_TokenReplacement_UnclosedToken + { + get { return GetString("AttributeRoute_TokenReplacement_UnclosedToken"); } + } + + /// + /// A replacement token is not closed. + /// + internal static string FormatAttributeRoute_TokenReplacement_UnclosedToken() + { + return GetString("AttributeRoute_TokenReplacement_UnclosedToken"); + } + + /// + /// An unescaped '[' token is not allowed inside of a replacement token. Use '[[' to escape. + /// + internal static string AttributeRoute_TokenReplacement_UnescapedBraceInToken + { + get { return GetString("AttributeRoute_TokenReplacement_UnescapedBraceInToken"); } + } + + /// + /// An unescaped '[' token is not allowed inside of a replacement token. Use '[[' to escape. + /// + internal static string FormatAttributeRoute_TokenReplacement_UnescapedBraceInToken() + { + return GetString("AttributeRoute_TokenReplacement_UnescapedBraceInToken"); + } + + /// + /// The value must be either '{0}' or '{1}'. + /// + internal static string RouteConstraintAttribute_InvalidKeyHandlingValue + { + get { return GetString("RouteConstraintAttribute_InvalidKeyHandlingValue"); } + } + + /// + /// The value must be either '{0}' or '{1}'. + /// + internal static string FormatRouteConstraintAttribute_InvalidKeyHandlingValue(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("RouteConstraintAttribute_InvalidKeyHandlingValue"), p0, p1); + } + + /// + /// Unable to find the required services. Please add all the required services by calling '{0}' inside the call to '{1}' or '{2}' in the application startup code. + /// + internal static string UnableToFindServices + { + get { return GetString("UnableToFindServices"); } + } + + /// + /// Unable to find the required services. Please add all the required services by calling '{0}' inside the call to '{1}' or '{2}' in the application startup code. + /// + internal static string FormatUnableToFindServices(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("UnableToFindServices"), p0, p1, p2); + } + + /// + /// Two or more routes named '{0}' have different templates. + /// + internal static string AttributeRoute_DifferentLinkGenerationEntries_SameName + { + get { return GetString("AttributeRoute_DifferentLinkGenerationEntries_SameName"); } + } + + /// + /// Two or more routes named '{0}' have different templates. + /// + internal static string FormatAttributeRoute_DifferentLinkGenerationEntries_SameName(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_DifferentLinkGenerationEntries_SameName"), p0); + } + + /// + /// Action: '{0}' - Template: '{1}' + /// + internal static string AttributeRoute_DuplicateNames_Item + { + get { return GetString("AttributeRoute_DuplicateNames_Item"); } + } + + /// + /// Action: '{0}' - Template: '{1}' + /// + internal static string FormatAttributeRoute_DuplicateNames_Item(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_DuplicateNames_Item"), p0, p1); + } + + /// + /// Attribute routes with the same name '{0}' must have the same template:{1}{2} + /// + internal static string AttributeRoute_DuplicateNames + { + get { return GetString("AttributeRoute_DuplicateNames"); } + } + + /// + /// Attribute routes with the same name '{0}' must have the same template:{1}{2} + /// + internal static string FormatAttributeRoute_DuplicateNames(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_DuplicateNames"), p0, p1, p2); + } + + /// + /// Error {0}:{1}{2} + /// + internal static string AttributeRoute_AggregateErrorMessage_ErrorNumber + { + get { return GetString("AttributeRoute_AggregateErrorMessage_ErrorNumber"); } + } + + /// + /// Error {0}:{1}{2} + /// + internal static string FormatAttributeRoute_AggregateErrorMessage_ErrorNumber(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_AggregateErrorMessage_ErrorNumber"), p0, p1, p2); + } + + /// + /// Could not find a replacement for view expansion token '{0}'. + /// + internal static string TemplatedViewLocationExpander_NoReplacementToken + { + get { return GetString("TemplatedViewLocationExpander_NoReplacementToken"); } + } + + /// + /// Could not find a replacement for view expansion token '{0}'. + /// + internal static string FormatTemplatedViewLocationExpander_NoReplacementToken(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TemplatedViewLocationExpander_NoReplacementToken"), p0); + } + + /// + /// {0} must be executed before {1} can be invoked. + /// + internal static string TemplatedExpander_PopulateValuesMustBeInvokedFirst + { + get { return GetString("TemplatedExpander_PopulateValuesMustBeInvokedFirst"); } + } + + /// + /// {0} must be executed before {1} can be invoked. + /// + internal static string FormatTemplatedExpander_PopulateValuesMustBeInvokedFirst(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TemplatedExpander_PopulateValuesMustBeInvokedFirst"), p0, p1); + } + + /// + /// The result of value factory cannot be null. + /// + internal static string TemplatedExpander_ValueFactoryCannotReturnNull + { + get { return GetString("TemplatedExpander_ValueFactoryCannotReturnNull"); } + } + + /// + /// The result of value factory cannot be null. + /// + internal static string FormatTemplatedExpander_ValueFactoryCannotReturnNull() + { + return GetString("TemplatedExpander_ValueFactoryCannotReturnNull"); + } + + /// + /// A method '{0}' must not define attribute routed actions and non attribute routed actions at the same time:{1}{2}{1}{1}Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a route, or set a route template in all attributes that constrain HTTP verbs. + /// + internal static string AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod + { + get { return GetString("AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod"); } + } + + /// + /// A method '{0}' must not define attribute routed actions and non attribute routed actions at the same time:{1}{2}{1}{1}Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a route, or set a route template in all attributes that constrain HTTP verbs. + /// + internal static string FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod"), p0, p1, p2); + } + + /// + /// Action: '{0}' - Route Template: '{1}' - HTTP Verbs: '{2}' + /// + internal static string AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item + { + get { return GetString("AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item"); } + } + + /// + /// Action: '{0}' - Route Template: '{1}' - HTTP Verbs: '{2}' + /// + internal static string FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item(object p0, object p1, object p2) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item"), p0, p1, p2); + } + + /// + /// (none) + /// + internal static string AttributeRoute_NullTemplateRepresentation + { + get { return GetString("AttributeRoute_NullTemplateRepresentation"); } + } + + /// + /// (none) + /// + internal static string FormatAttributeRoute_NullTemplateRepresentation() + { + return GetString("AttributeRoute_NullTemplateRepresentation"); + } + + /// + /// Multiple actions matched. The following actions matched route data and had all constraints satisfied:{0}{0}{1} + /// + internal static string DefaultActionSelector_AmbiguousActions + { + get { return GetString("DefaultActionSelector_AmbiguousActions"); } + } + + /// + /// Multiple actions matched. The following actions matched route data and had all constraints satisfied:{0}{0}{1} + /// + internal static string FormatDefaultActionSelector_AmbiguousActions(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("DefaultActionSelector_AmbiguousActions"), p0, p1); + } + + /// + /// Could not find file: {0} + /// + internal static string FileResult_InvalidPath + { + get { return GetString("FileResult_InvalidPath"); } + } + + /// + /// Could not find file: {0} + /// + internal static string FormatFileResult_InvalidPath(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("FileResult_InvalidPath"), p0); + } + + /// + /// Type: '{0}' - Name: '{1}' + /// + internal static string ViewComponent_AmbiguousTypeMatch_Item + { + get { return GetString("ViewComponent_AmbiguousTypeMatch_Item"); } + } + + /// + /// Type: '{0}' - Name: '{1}' + /// + internal static string FormatViewComponent_AmbiguousTypeMatch_Item(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ViewComponent_AmbiguousTypeMatch_Item"), p0, p1); + } + + /// + /// The input was not valid. + /// + internal static string SerializableError_DefaultError + { + get { return GetString("SerializableError_DefaultError"); } + } + + /// + /// The input was not valid. + /// + internal static string FormatSerializableError_DefaultError() + { + return GetString("SerializableError_DefaultError"); + } + + /// + /// If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + /// + internal static string AsyncResourceFilter_InvalidShortCircuit + { + get { return GetString("AsyncResourceFilter_InvalidShortCircuit"); } + } + + /// + /// If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + /// + internal static string FormatAsyncResourceFilter_InvalidShortCircuit(object p0, object p1, object p2, object p3) + { + return string.Format(CultureInfo.CurrentCulture, GetString("AsyncResourceFilter_InvalidShortCircuit"), p0, p1, p2, p3); + } + + /// + /// If the '{0}' property is not set to true, '{1}' property must be specified. + /// + internal static string ResponseCache_SpecifyDuration + { + get { return GetString("ResponseCache_SpecifyDuration"); } + } + + /// + /// If the '{0}' property is not set to true, '{1}' property must be specified. + /// + internal static string FormatResponseCache_SpecifyDuration(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ResponseCache_SpecifyDuration"), p0, p1); + } + + /// + /// The action '{0}' has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer. + /// + internal static string ApiExplorer_UnsupportedAction + { + get { return GetString("ApiExplorer_UnsupportedAction"); } + } + + /// + /// The action '{0}' has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer. + /// + internal static string FormatApiExplorer_UnsupportedAction(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ApiExplorer_UnsupportedAction"), p0); + } + + /// + /// The media type "{0}" is not valid. MediaTypes containing wildcards (*) are not allowed in formatter mappings. + /// + internal static string FormatterMappings_NotValidMediaType + { + get { return GetString("FormatterMappings_NotValidMediaType"); } + } + + /// + /// The media type "{0}" is not valid. MediaTypes containing wildcards (*) are not allowed in formatter mappings. + /// + internal static string FormatFormatterMappings_NotValidMediaType(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("FormatterMappings_NotValidMediaType"), p0); + } + + /// + /// The format provided is invalid '{0}'. A format must be a non-empty file-extension, optionally prefixed with a '.' character. + /// + internal static string Format_NotValid + { + get { return GetString("Format_NotValid"); } + } + + /// + /// The format provided is invalid '{0}'. A format must be a non-empty file-extension, optionally prefixed with a '.' character. + /// + internal static string FormatFormat_NotValid(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Format_NotValid"), p0); + } + + /// + /// The property '{0}' on controller '{1}' cannot be activated. + /// + internal static string ControllerFactory_PropertyCannotBeActivated + { + get { return GetString("ControllerFactory_PropertyCannotBeActivated"); } + } + + /// + /// The property '{0}' on controller '{1}' cannot be activated. + /// + internal static string FormatControllerFactory_PropertyCannotBeActivated(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ControllerFactory_PropertyCannotBeActivated"), p0, p1); + } + + /// + /// No URL for remote validation could be found. + /// + internal static string RemoteAttribute_NoUrlFound + { + get { return GetString("RemoteAttribute_NoUrlFound"); } + } + + /// + /// No URL for remote validation could be found. + /// + internal static string FormatRemoteAttribute_NoUrlFound() + { + return GetString("RemoteAttribute_NoUrlFound"); + } + + /// + /// '{0}' is invalid. + /// + internal static string RemoteAttribute_RemoteValidationFailed + { + get { return GetString("RemoteAttribute_RemoteValidationFailed"); } + } + + /// + /// '{0}' is invalid. + /// + internal static string FormatRemoteAttribute_RemoteValidationFailed(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("RemoteAttribute_RemoteValidationFailed"), p0); + } + + /// + /// The '{0}' cache profile is not defined. + /// + internal static string CacheProfileNotFound + { + get { return GetString("CacheProfileNotFound"); } + } + + /// + /// The '{0}' cache profile is not defined. + /// + internal static string FormatCacheProfileNotFound(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("CacheProfileNotFound"), p0); + } + + /// + /// The model's runtime type '{0}' is not assignable to the type '{1}'. + /// + internal static string ModelType_WrongType + { + get { return GetString("ModelType_WrongType"); } + } + + /// + /// The model's runtime type '{0}' is not assignable to the type '{1}'. + /// + internal static string FormatModelType_WrongType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelType_WrongType"), p0, p1); + } + + /// + /// The '{0}' cannot serialize an object of type '{1}' to session state. + /// + internal static string TempData_CannotSerializeToSession + { + get { return GetString("TempData_CannotSerializeToSession"); } + } + + /// + /// The '{0}' cannot serialize an object of type '{1}' to session state. + /// + internal static string FormatTempData_CannotSerializeToSession(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TempData_CannotSerializeToSession"), p0, p1); + } + + /// + /// Cannot deserialize {0} of type '{1}'. + /// + internal static string TempData_CannotDeserializeToken + { + get { return GetString("TempData_CannotDeserializeToken"); } + } + + /// + /// Cannot deserialize {0} of type '{1}'. + /// + internal static string FormatTempData_CannotDeserializeToken(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TempData_CannotDeserializeToken"), p0, p1); + } + + /// + /// The '{0}' cannot serialize a dictionary with a key of type '{1}' to session state. + /// + internal static string TempData_CannotSerializeDictionary + { + get { return GetString("TempData_CannotSerializeDictionary"); } + } + + /// + /// The '{0}' cannot serialize a dictionary with a key of type '{1}' to session state. + /// + internal static string FormatTempData_CannotSerializeDictionary(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TempData_CannotSerializeDictionary"), p0, p1); + } + + /// + /// The type '{0}' cannot be activated by '{1}' because it is either a value type, an interface, an abstract class or an open generic type. + /// + internal static string ValueInterfaceAbstractOrOpenGenericTypesCannotBeActivated + { + get { return GetString("ValueInterfaceAbstractOrOpenGenericTypesCannotBeActivated"); } + } + + /// + /// The type '{0}' cannot be activated by '{1}' because it is either a value type, an interface, an abstract class or an open generic type. + /// + internal static string FormatValueInterfaceAbstractOrOpenGenericTypesCannotBeActivated(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ValueInterfaceAbstractOrOpenGenericTypesCannotBeActivated"), p0, p1); + } + + /// + /// The type '{0}' must implement '{1}' to be used as a model binder. + /// + internal static string BinderType_MustBeIModelBinder + { + get { return GetString("BinderType_MustBeIModelBinder"); } + } + + /// + /// The type '{0}' must implement '{1}' to be used as a model binder. + /// + internal static string FormatBinderType_MustBeIModelBinder(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BinderType_MustBeIModelBinder"), p0, p1); + } + + /// + /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + /// + internal static string BindingSource_CannotBeComposite + { + get { return GetString("BindingSource_CannotBeComposite"); } + } + + /// + /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + /// + internal static string FormatBindingSource_CannotBeComposite(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeComposite"), p0, p1); + } + + /// + /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + /// + internal static string BindingSource_CannotBeGreedy + { + get { return GetString("BindingSource_CannotBeGreedy"); } + } + + /// + /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + /// + internal static string FormatBindingSource_CannotBeGreedy(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeGreedy"), p0, p1); + } + + /// + /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + /// + internal static string BindingSource_MustBeFromRequest + { + get { return GetString("BindingSource_MustBeFromRequest"); } + } + + /// + /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + /// + internal static string FormatBindingSource_MustBeFromRequest(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeFromRequest"), p0, p1); + } + + /// + /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + /// + internal static string BindingSource_MustBeGreedy + { + get { return GetString("BindingSource_MustBeGreedy"); } + } + + /// + /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + /// + internal static string FormatBindingSource_MustBeGreedy(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeGreedy"), p0, p1); + } + + /// + /// The property {0}.{1} could not be found. + /// + internal static string Common_PropertyNotFound + { + get { return GetString("Common_PropertyNotFound"); } + } + + /// + /// The property {0}.{1} could not be found. + /// + internal static string FormatCommon_PropertyNotFound(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Common_PropertyNotFound"), p0, p1); + } + + /// + /// A value is required. + /// + internal static string KeyValuePair_BothKeyAndValueMustBePresent + { + get { return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); } + } + + /// + /// A value is required. + /// + internal static string FormatKeyValuePair_BothKeyAndValueMustBePresent() + { + return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); + } + + /// + /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + /// + internal static string ModelBinderUtil_ModelCannotBeNull + { + get { return GetString("ModelBinderUtil_ModelCannotBeNull"); } + } + + /// + /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + /// + internal static string FormatModelBinderUtil_ModelCannotBeNull(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelCannotBeNull"), p0); + } + + /// + /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string ModelBinderUtil_ModelInstanceIsWrong + { + get { return GetString("ModelBinderUtil_ModelInstanceIsWrong"); } + } + + /// + /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string FormatModelBinderUtil_ModelInstanceIsWrong(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelInstanceIsWrong"), p0, p1); + } + + /// + /// The binding context cannot have a null ModelMetadata. + /// + internal static string ModelBinderUtil_ModelMetadataCannotBeNull + { + get { return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); } + } + + /// + /// The binding context cannot have a null ModelMetadata. + /// + internal static string FormatModelBinderUtil_ModelMetadataCannotBeNull() + { + return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); + } + + /// + /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string ModelBinderUtil_ModelTypeIsWrong + { + get { return GetString("ModelBinderUtil_ModelTypeIsWrong"); } + } + + /// + /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string FormatModelBinderUtil_ModelTypeIsWrong(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelTypeIsWrong"), p0, p1); + } + + /// + /// The value '{0}' is not valid for {1}. + /// + internal static string ModelBinderUtil_ValueInvalid + { + get { return GetString("ModelBinderUtil_ValueInvalid"); } + } + + /// + /// The value '{0}' is not valid for {1}. + /// + internal static string FormatModelBinderUtil_ValueInvalid(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalid"), p0, p1); + } + + /// + /// The supplied value is invalid for {0}. + /// + internal static string ModelBinderUtil_ValueInvalidGeneric + { + get { return GetString("ModelBinderUtil_ValueInvalidGeneric"); } + } + + /// + /// The supplied value is invalid for {0}. + /// + internal static string FormatModelBinderUtil_ValueInvalidGeneric(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalidGeneric"), p0); + } + + /// + /// The '{0}' property is required. + /// + internal static string ModelBinding_MissingRequiredMember + { + get { return GetString("ModelBinding_MissingRequiredMember"); } + } + + /// + /// The '{0}' property is required. + /// + internal static string FormatModelBinding_MissingRequiredMember(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinding_MissingRequiredMember"), p0); + } + + /// + /// A value is required. + /// + internal static string ModelBinding_ValueRequired + { + get { return GetString("ModelBinding_ValueRequired"); } + } + + /// + /// A value is required. + /// + internal static string FormatModelBinding_ValueRequired() + { + return GetString("ModelBinding_ValueRequired"); + } + + /// + /// More than one parameter and/or property is bound to the HTTP request's content. + /// + internal static string MultipleBodyParametersOrPropertiesAreNotAllowed + { + get { return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); } + } + + /// + /// More than one parameter and/or property is bound to the HTTP request's content. + /// + internal static string FormatMultipleBodyParametersOrPropertiesAreNotAllowed() + { + return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); + } + + /// + /// The type '{0}' does not implement the interface '{1}'. + /// + internal static string PropertyBindingPredicateProvider_WrongType + { + get { return GetString("PropertyBindingPredicateProvider_WrongType"); } + } + + /// + /// The type '{0}' does not implement the interface '{1}'. + /// + internal static string FormatPropertyBindingPredicateProvider_WrongType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("PropertyBindingPredicateProvider_WrongType"), p0, p1); + } + + /// + /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + /// + internal static string ValidatableObjectAdapter_IncompatibleType + { + get { return GetString("ValidatableObjectAdapter_IncompatibleType"); } + } + + /// + /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + /// + internal static string FormatValidatableObjectAdapter_IncompatibleType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ValidatableObjectAdapter_IncompatibleType"), p0, p1); + } + + private static string GetString(string name, params string[] formatterNames) + { + var value = _resourceManager.GetString(name); + + System.Diagnostics.Debug.Assert(value != null); + + if (formatterNames != null) + { + for (var i = 0; i < formatterNames.Length; i++) + { + value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); + } + } + + return value; + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/RedirectResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/RedirectResult.cs index a5c0e667c3..4cf7a6b3c7 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/RedirectResult.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToActionResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/RedirectToActionResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToActionResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/RedirectToActionResult.cs index 8f8e84a2ec..8711cf5383 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToActionResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/RedirectToActionResult.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToRouteResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/RedirectToRouteResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToRouteResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/RedirectToRouteResult.cs index a830428bfd..3f189f1577 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/RedirectToRouteResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/RedirectToRouteResult.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/RemoteAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/RemoteAttribute.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/RemoteAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/RemoteAttribute.cs index 982d08fcc8..229cb3522f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/RemoteAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/RemoteAttribute.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Globalization; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.Internal; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Routing; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/DynamicViewData.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/DynamicViewData.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/DynamicViewData.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/DynamicViewData.cs index c405fe40d8..5769a1d916 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/DynamicViewData.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/DynamicViewData.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Dynamic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.Rendering diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/CachedExpressionCompiler.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/CachedExpressionCompiler.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/CachedExpressionCompiler.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/CachedExpressionCompiler.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionHelper.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionHelper.cs index 959553daf9..28f98cc4fe 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionHelper.cs @@ -7,7 +7,7 @@ using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.Rendering.Expressions diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionMetadataProvider.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionMetadataProvider.cs index bd25003f20..eeb93fe473 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ExpressionMetadataProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ExpressionMetadataProvider.cs @@ -5,7 +5,7 @@ using System; using System.Globalization; using System.Linq.Expressions; using System.Reflection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/TryGetValueDelegate.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/TryGetValueDelegate.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/TryGetValueDelegate.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/TryGetValueDelegate.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/TryGetValueProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/TryGetValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/TryGetValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/TryGetValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ViewDataEvaluator.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ViewDataEvaluator.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ViewDataEvaluator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ViewDataEvaluator.cs index d2b5b86859..fc5964d396 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ViewDataEvaluator.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ViewDataEvaluator.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Reflection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.Rendering.Expressions diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ViewDataInfo.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ViewDataInfo.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Expressions/ViewDataInfo.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Expressions/ViewDataInfo.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/FormMethod.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/FormMethod.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/FormMethod.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/FormMethod.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultDisplayTemplates.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultDisplayTemplates.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultDisplayTemplates.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultDisplayTemplates.cs index c7fa4fba3c..c2c28877f2 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultDisplayTemplates.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultDisplayTemplates.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Text; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering.Internal; using Microsoft.Framework.DependencyInjection; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultEditorTemplates.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultEditorTemplates.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultEditorTemplates.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultEditorTemplates.cs index 2d16f6e71f..c06eb66bed 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultEditorTemplates.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultEditorTemplates.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Text; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering.Internal; using Microsoft.Framework.DependencyInjection; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultHtmlGenerator.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultHtmlGenerator.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultHtmlGenerator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultHtmlGenerator.cs index e18b220e96..1a4f086da7 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/DefaultHtmlGenerator.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/DefaultHtmlGenerator.cs @@ -9,7 +9,7 @@ using System.Globalization; using System.Linq; using System.Reflection; using System.Text; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Mvc.Rendering.Expressions; @@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Mvc.Rendering /// The . public DefaultHtmlGenerator( [NotNull] AntiForgery antiForgery, - [NotNull] IOptions optionsAccessor, + [NotNull] IOptions optionsAccessor, [NotNull] IModelMetadataProvider metadataProvider, [NotNull] IUrlHelper urlHelper, [NotNull] IHtmlEncoder htmlEncoder) diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelper.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelper.cs index e8c4662b84..d4256e17bf 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelper.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Mvc.Rendering.Expressions; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelperOfT.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelperOfT.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelperOfT.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelperOfT.cs index a24f68a62b..028e917b14 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelperOfT.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/HtmlHelperOfT.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq.Expressions; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering.Expressions; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/IHtmlGenerator.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/IHtmlGenerator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/IHtmlGenerator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/IHtmlGenerator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/InputType.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/InputType.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/InputType.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/InputType.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/TagBuilder.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/TagBuilder.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/TagBuilder.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/TagBuilder.cs index 4e16692442..faacf3b274 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/TagBuilder.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/TagBuilder.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; using Microsoft.Framework.WebEncoders; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/TagRenderMode.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/TagRenderMode.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/TagRenderMode.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/TagRenderMode.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/ValidationHelpers.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/ValidationHelpers.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html/ValidationHelpers.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/ValidationHelpers.cs index 5be06a761f..b2d5286abb 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html/ValidationHelpers.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html/ValidationHelpers.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Html5DateRenderingMode.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html5DateRenderingMode.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Html5DateRenderingMode.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Html5DateRenderingMode.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlAttributePropertyHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlAttributePropertyHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlAttributePropertyHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlAttributePropertyHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperDisplayExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperDisplayExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperDisplayExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperDisplayExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperDisplayNameExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperDisplayNameExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperDisplayNameExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperDisplayNameExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperEditorExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperEditorExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperEditorExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperEditorExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperFormExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperFormExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperFormExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperFormExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperInputExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperInputExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperInputExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperInputExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperLabelExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperLabelExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperLabelExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperLabelExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperLinkExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperLinkExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperLinkExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperLinkExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperNameExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperNameExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperNameExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperNameExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperOptions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperOptions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperOptions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperOptions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperPartialExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperPartialExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperPartialExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperPartialExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperSelectExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperSelectExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperSelectExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperSelectExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperValidationExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperValidationExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperValidationExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperValidationExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperValueExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperValueExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlHelperValueExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlHelperValueExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlString.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlString.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/HtmlString.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/HtmlString.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ICanHasViewContext.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ICanHasViewContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ICanHasViewContext.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ICanHasViewContext.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/IHtmlHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/IHtmlHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/IHtmlHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/IHtmlHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/IHtmlHelperOfT.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/IHtmlHelperOfT.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/IHtmlHelperOfT.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/IHtmlHelperOfT.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/IJsonHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/IJsonHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/IJsonHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/IJsonHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Internal/TemplateBuilder.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Internal/TemplateBuilder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Internal/TemplateBuilder.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Internal/TemplateBuilder.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/Internal/TemplateRenderer.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Internal/TemplateRenderer.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/Internal/TemplateRenderer.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/Internal/TemplateRenderer.cs index 989a5858eb..eaaf7bb0a4 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/Internal/TemplateRenderer.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/Internal/TemplateRenderer.cs @@ -9,7 +9,7 @@ using System.IO; using System.Linq; using System.Reflection; using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/JsonHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/JsonHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/JsonHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/JsonHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ModelExpression.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ModelExpression.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ModelExpression.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ModelExpression.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/MultiSelectList.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/MultiSelectList.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/MultiSelectList.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/MultiSelectList.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/MvcForm.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/MvcForm.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/MvcForm.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/MvcForm.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/SelectList.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectList.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/SelectList.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectList.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/SelectListGroup.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectListGroup.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/SelectListGroup.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectListGroup.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/SelectListItem.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectListItem.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/SelectListItem.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/SelectListItem.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/StringCollectionTextWriter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/StringCollectionTextWriter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/StringCollectionTextWriter.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/StringCollectionTextWriter.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/UnobtrusiveValidationAttributesGenerator.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/UnobtrusiveValidationAttributesGenerator.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/UnobtrusiveValidationAttributesGenerator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/UnobtrusiveValidationAttributesGenerator.cs index 2211261ff2..3666786a73 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/UnobtrusiveValidationAttributesGenerator.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/UnobtrusiveValidationAttributesGenerator.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/CompositeViewEngine.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/CompositeViewEngine.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/CompositeViewEngine.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/CompositeViewEngine.cs index 491a7ca39f..2d8bc0da0f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/CompositeViewEngine.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/CompositeViewEngine.cs @@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Mvc.Rendering /// A instance that retrieves services from the /// service collection. public CompositeViewEngine( - IOptions optionsAccessor, + IOptions optionsAccessor, ITypeActivatorCache typeActivatorCache, IServiceProvider serviceProvider) { diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/ICompositeViewEngine.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/ICompositeViewEngine.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/ICompositeViewEngine.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/ICompositeViewEngine.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/IView.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/IView.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/IView.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/IView.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/IViewEngine.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/IViewEngine.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/IViewEngine.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/IViewEngine.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/ViewEngineResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/ViewEngineResult.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/ViewEngineResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/ViewEngineResult.cs index 060c5a3a72..eead6366e7 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Rendering/ViewEngine/ViewEngineResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/Rendering/ViewEngine/ViewEngineResult.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.Rendering diff --git a/src/Microsoft.AspNet.Mvc.Core/RequireHttpsAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/RequireHttpsAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/RequireHttpsAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/RequireHttpsAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Resources.resx b/src/Microsoft.AspNet.Mvc.Extensions/Resources.resx new file mode 100644 index 0000000000..7575c2a6b2 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/Resources.resx @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The argument '{0}' is invalid. Media types which match all types or match all subtypes are not supported. + + + The content-type '{0}' added in the '{1}' property is invalid. Media types which match all types or match all subtypes are not supported. + + + The provided anti-forgery token failed a custom data check. + + + The provided anti-forgery token was meant for a different claims-based user than the current user. + + + The required anti-forgery cookie "{0}" is not present. + + + The anti-forgery token could not be decrypted. + + + The required anti-forgery form field "{0}" is not present. + + + The anti-forgery cookie token and form field token do not match. + + + Validation of the provided anti-forgery token failed. The cookie "{0}" and the form field "{1}" were swapped. + + + The provided anti-forgery token was meant for user "{0}", but the current user is "{1}". + + + The anti-forgery system has the configuration value AntiForgeryOptions.RequireSsl = true, but the current request is not an SSL request. + + + The method '{0}' on type '{1}' returned an instance of '{2}'. Make sure to call Unwrap on the returned value to avoid unobserved faulted Task. + + + The method '{0}' on type '{1}' returned a Task instance even though it is not an asynchronous method. + + + A claim of type '{0}' was not present on the provided ClaimsIdentity. + + + The provided identity of type '{0}' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider extending IAdditionalDataProvider by overriding the DefaultAdditionalDataProvider or a custom type that can provide some form of unique identifier for the current user. + + + The class ReflectedActionFilterEndPoint only supports ReflectedActionDescriptors. + + + The view component name '{0}' matched multiple types:{1}{2} + {1} is the newline character + + + The async view component method '{0}' should be declared to return Task<T>. + + + A view component must return a non-null value. + + + The view component method '{0}' should be declared to return a value. + + + A view component named '{0}' could not be found. + + + An invoker could not be created for the view component '{0}'. + + + Could not find an '{0}' method matching the parameters. + + + Could not find an '{0}' or '{1}' method matching the parameters. + + + View components only support returning {0}, {1} or {2}. + + + Replacing the action context is not supported. + + + An action invoker could not be created for action '{0}'. + + + The action descriptor must be of type '{0}'. + + + Value cannot be null or empty. + + + The '{0}' property of '{1}' must not be null. + + + The '{0}' method of type '{1}' cannot return a null value. + + + The supplied route values are ambiguous and can select multiple sets of actions. + + + Property '{0}' is of type '{1}', but this method requires a value of type '{2}'. + + + The partial view '{0}' was not found or no view engine supports the searched locations. The following locations were searched:{1} + + + The value '{0}' is invalid. + + + False + + + Not Set + + + True + + + ViewData value must not be null. + + + The expression compiler was unable to evaluate the indexer expression '{0}' because it references the model parameter '{1}' which is unavailable. + + + The passed expression of expression node type '{0}' is invalid. Only simple member access expressions for model properties are supported. + + + The IModelMetadataProvider was unable to provide metadata for expression '{0}'. + + + Must call 'Contextualize' method before using this HtmlHelper instance. + + + There is no ViewData item of type '{0}' that has the key '{1}'. + + + The parameter '{0}' must evaluate to an IEnumerable when multiple selection is allowed. + + + The type '{0}' is not supported. Type must be an {1} that does not have an associated {2}. + + + The ViewData item that has the key '{0}' is of type '{1}' but must be of type '{2}'. + + + The '{0}' template was used with an object of type '{1}', which does not implement '{2}'. + + + Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions. + + + Unable to locate an appropriate template for type {0}. + + + The model item passed is null, but this ViewDataDictionary instance requires a non-null model item of type '{0}'. + + + The model item passed into the ViewDataDictionary is of type '{0}', but this ViewDataDictionary instance requires a model item of type '{1}'. + + + No route matches the supplied values. + + + If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + + + If an {0} cancels execution by setting the {1} property of {2} to 'true', then it cannot call the next filter by invoking {3}. + + + The partial view '{0}' was not found. The following locations were searched:{1} + + + The view '{0}' was not found. The following locations were searched:{1}. + + + Unable to locate an implementation of IAuthorizationService. + + + OnAuthorization is not implemented by this filter, use OnAuthorizationAsync instead. + + + The value must be greater than or equal to zero. + + + The type provided to '{0}' must implement '{1}'. + + + Validation parameter names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + + + Validation parameter names in unobtrusive client validation rules must start with a lowercase letter and consist of only lowercase letters or digits. Validation parameter name: {0}, client rule type: {1} + + + Validation type names in unobtrusive client validation rules cannot be empty. Client rule type: {0} + + + Validation type names in unobtrusive client validation rules must consist of only lowercase letters. Invalid name: "{0}", client rule type: {1} + + + Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: {0} + + + Cannot return null from an action method with a return type of '{0}'. + + + The type '{0}' must derive from '{1}'. + + + No encoding found for output formatter '{0}'. There must be at least one supported encoding registered in order for the output formatter to write content. + + + No encoding found for input formatter '{0}'. There must be at least one supported encoding registered in order for the formatter to read content. + + + Unsupported content type '{0}'. + + + No supported media type registered for output formatter '{0}'. There must be at least one supported media type registered in order for the output formatter to write content. + + + The following errors occurred with attribute routing information:{0}{0}{1} + {0} is the newline. {1} is the formatted list of errors using AttributeRoute_IndividualErrorMessage + + + The attribute route '{0}' cannot contain a parameter named '{{{1}}}'. Use '[{1}]' in the route template to insert the value '{2}'. + + + For action: '{0}'{1}Error: {2} + {1} is the newline. + + + An empty replacement token ('[]') is not allowed. + + + Token delimiters ('[', ']') are imbalanced. + + + The route template '{0}' has invalid syntax. {1} + {1} is the specific error message. + + + While processing template '{0}', a replacement value for the token '{1}' could not be found. Available tokens: '{2}'. + + + A replacement token is not closed. + + + An unescaped '[' token is not allowed inside of a replacement token. Use '[[' to escape. + + + The value must be either '{0}' or '{1}'. + + + Unable to find the required services. Please add all the required services by calling '{0}' inside the call to '{1}' or '{2}' in the application startup code. + + + Two or more routes named '{0}' have different templates. + + + Action: '{0}' - Template: '{1}' + Formats an action descriptor display name and it's associated template. + + + Attribute routes with the same name '{0}' must have the same template:{1}{2} + {0} is the name of the attribute route, {1} is the newline, {2} is the list of errors formatted using ActionDescriptor_WithNamedAttributeRouteAndDifferentTemplate + + + Error {0}:{1}{2} + {0} is the error number, {1} is Environment.NewLine {2} is the error message + + + Could not find a replacement for view expansion token '{0}'. + + + {0} must be executed before {1} can be invoked. + + + The result of value factory cannot be null. + + + A method '{0}' must not define attribute routed actions and non attribute routed actions at the same time:{1}{2}{1}{1}Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a route, or set a route template in all attributes that constrain HTTP verbs. + {0} is the MethodInfo.FullName, {1} is Environment.NewLine, {2} is the formatted list of actions defined by that method info. + + + Action: '{0}' - Route Template: '{1}' - HTTP Verbs: '{2}' + + + (none) + + + Multiple actions matched. The following actions matched route data and had all constraints satisfied:{0}{0}{1} + 0 is the newline - 1 is a newline separate list of action display names + + + Could not find file: {0} + {0} is the value for the provided path + + + Type: '{0}' - Name: '{1}' + + + The input was not valid. + + + If an {0} provides a result value by setting the {1} property of {2} to a non-null value, then it cannot call the next filter by invoking {3}. + + + If the '{0}' property is not set to true, '{1}' property must be specified. + + + The action '{0}' has ApiExplorer enabled, but is using conventional routing. Only actions which use attribute routing support ApiExplorer. + + + The media type "{0}" is not valid. MediaTypes containing wildcards (*) are not allowed in formatter mappings. + + + The format provided is invalid '{0}'. A format must be a non-empty file-extension, optionally prefixed with a '.' character. + + + The property '{0}' on controller '{1}' cannot be activated. + + + No URL for remote validation could be found. + + + '{0}' is invalid. + + + The '{0}' cache profile is not defined. + + + The model's runtime type '{0}' is not assignable to the type '{1}'. + + + The '{0}' cannot serialize an object of type '{1}' to session state. + + + Cannot deserialize {0} of type '{1}'. + + + The '{0}' cannot serialize a dictionary with a key of type '{1}' to session state. + + + The type '{0}' cannot be activated by '{1}' because it is either a value type, an interface, an abstract class or an open generic type. + + + The type '{0}' must implement '{1}' to be used as a model binder. + + + The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + + + The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + + + The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + + + The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + + + The property {0}.{1} could not be found. + + + A value is required. + + + The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + + + The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + + + The binding context cannot have a null ModelMetadata. + + + The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + + + The value '{0}' is not valid for {1}. + + + The supplied value is invalid for {0}. + + + The '{0}' property is required. + + + A value is required. + + + More than one parameter and/or property is bound to the HTTP request's content. + + + The type '{0}' does not implement the interface '{1}'. + + + The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + + \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/ResponseCacheLocation.cs b/src/Microsoft.AspNet.Mvc.Extensions/ResponseCacheLocation.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ResponseCacheLocation.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ResponseCacheLocation.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/SerializableError.cs b/src/Microsoft.AspNet.Mvc.Extensions/SerializableError.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/SerializableError.cs rename to src/Microsoft.AspNet.Mvc.Extensions/SerializableError.cs index 78f52f3049..fcde2312f6 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/SerializableError.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/SerializableError.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ServiceBasedControllerActivator.cs b/src/Microsoft.AspNet.Mvc.Extensions/ServiceBasedControllerActivator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ServiceBasedControllerActivator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ServiceBasedControllerActivator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/TemplateInfo.cs b/src/Microsoft.AspNet.Mvc.Extensions/TemplateInfo.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/TemplateInfo.cs rename to src/Microsoft.AspNet.Mvc.Extensions/TemplateInfo.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/UnsupportedMediaTypeResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/UnsupportedMediaTypeResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/UnsupportedMediaTypeResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/UnsupportedMediaTypeResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ContentViewComponentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ContentViewComponentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ContentViewComponentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ContentViewComponentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentActivator.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentActivator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentActivator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentActivator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentDescriptorCollectionProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentDescriptorCollectionProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentDescriptorCollectionProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentDescriptorCollectionProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentDescriptorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentDescriptorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentDescriptorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentDescriptorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentHelper.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentHelper.cs index 826da0fc22..7ef13e5b0d 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentHelper.cs @@ -5,7 +5,7 @@ using System; using System.IO; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentInvoker.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentInvoker.cs index 5137346e8e..865c459769 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvoker.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentInvoker.cs @@ -5,7 +5,7 @@ using System; using System.Reflection; using System.Runtime.ExceptionServices; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvokerFactory.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentInvokerFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentInvokerFactory.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentInvokerFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentSelector.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentSelector.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentSelector.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentSelector.cs index 6c63cc4163..a59109146f 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/DefaultViewComponentSelector.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/DefaultViewComponentSelector.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ViewComponents diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentActivator.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentActivator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentActivator.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentActivator.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentDescriptorCollectionProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentDescriptorCollectionProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentDescriptorCollectionProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentDescriptorCollectionProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentDescriptorProvider.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentDescriptorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentDescriptorProvider.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentDescriptorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentHelper.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentHelper.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentHelper.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentHelper.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentInvoker.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentInvoker.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentInvoker.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentInvoker.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentInvokerFactory.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentInvokerFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentInvokerFactory.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentInvokerFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentSelector.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentSelector.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/IViewComponentSelector.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/IViewComponentSelector.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/JsonViewComponentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/JsonViewComponentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/JsonViewComponentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/JsonViewComponentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponent.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponent.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponent.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponent.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentContext.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentContext.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentContext.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentContextAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentContextAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentContextAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentContextAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentConventions.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentConventions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentConventions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentConventions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentDescriptor.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentDescriptor.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentDescriptor.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentDescriptor.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentDescriptorCollection.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentDescriptorCollection.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentDescriptorCollection.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentDescriptorCollection.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentHelperExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentHelperExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentHelperExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentHelperExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentMethodSelector.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentMethodSelector.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentMethodSelector.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentMethodSelector.cs index 64952df7df..64acd8d0ac 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewComponentMethodSelector.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewComponentMethodSelector.cs @@ -5,7 +5,7 @@ using System; using System.Linq.Expressions; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ViewComponents diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewViewComponentResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewViewComponentResult.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewComponents/ViewViewComponentResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewComponents/ViewViewComponentResult.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewContext.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewContext.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewContext.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewContextAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewContextAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewContextAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewContextAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewDataDictionary.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionary.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.Core/ViewDataDictionary.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionary.cs index be20b82eba..0e887cca18 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewDataDictionary.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionary.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Reflection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering.Expressions; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewDataDictionaryAttribute.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewDataDictionaryAttribute.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryControllerPropertyActivator.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryControllerPropertyActivator.cs new file mode 100644 index 0000000000..66974be736 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryControllerPropertyActivator.cs @@ -0,0 +1,57 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using Microsoft.AspNet.Mvc.ModelBinding; +using Microsoft.Framework.Internal; + +namespace Microsoft.AspNet.Mvc +{ + public class ViewDataDictionaryControllerPropertyActivator : IControllerPropertyActivator + { + private readonly IModelMetadataProvider _modelMetadataProvider; + private readonly ConcurrentDictionary[]> _activateActions; + private readonly Func[]> _getPropertiesToActivate; + + public ViewDataDictionaryControllerPropertyActivator(IModelMetadataProvider modelMetadataProvider) + { + _modelMetadataProvider = modelMetadataProvider; + + _activateActions = new ConcurrentDictionary[]>(); + _getPropertiesToActivate = GetPropertiesToActivate; + } + + public void Activate(ActionContext actionContext, object controller) + { + var controllerType = controller.GetType(); + var propertiesToActivate = _activateActions.GetOrAdd( + controllerType, + _getPropertiesToActivate); + + for (var i = 0; i < propertiesToActivate.Length; i++) + { + var activateInfo = propertiesToActivate[i]; + activateInfo.Activate(controller, actionContext); + } + } + + private PropertyActivator[] GetPropertiesToActivate(Type type) + { + var activators = PropertyActivator.GetPropertiesToActivate( + type, + typeof(ViewDataDictionaryAttribute), + p => new PropertyActivator(p, GetViewDataDictionary)); + + return activators; + } + + private ViewDataDictionary GetViewDataDictionary(ActionContext context) + { + var serviceProvider = context.HttpContext.RequestServices; + return new ViewDataDictionary( + _modelMetadataProvider, + context.ModelState); + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewDataDictionaryOfT.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryOfT.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewDataDictionaryOfT.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewDataDictionaryOfT.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewEngineDescriptor.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewEngineDescriptor.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ViewEngineDescriptor.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewEngineDescriptor.cs index 951d77d408..6a898ca9c5 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ViewEngineDescriptor.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewEngineDescriptor.cs @@ -3,7 +3,7 @@ using System; using System.Reflection; -using Microsoft.AspNet.Mvc.Core; +using Microsoft.AspNet.Mvc.Extensions; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/ViewEngineDescriptorExtensions.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewEngineDescriptorExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ViewEngineDescriptorExtensions.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewEngineDescriptorExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ViewExecutor.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewExecutor.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/ViewExecutor.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewExecutor.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ViewResult.cs b/src/Microsoft.AspNet.Mvc.Extensions/ViewResult.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.Core/ActionResults/ViewResult.cs rename to src/Microsoft.AspNet.Mvc.Extensions/ViewResult.cs index bd3b61b189..625d3f2c0a 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResults/ViewResult.cs +++ b/src/Microsoft.AspNet.Mvc.Extensions/ViewResult.cs @@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Mvc var logger = context.HttpContext.RequestServices.GetRequiredService>(); - var options = context.HttpContext.RequestServices.GetRequiredService>(); + var options = context.HttpContext.RequestServices.GetRequiredService>(); var viewName = ViewName ?? context.ActionDescriptor.Name; var viewEngineResult = viewEngine.FindView(context, viewName); diff --git a/src/Microsoft.AspNet.Mvc.Extensions/project.json b/src/Microsoft.AspNet.Mvc.Extensions/project.json new file mode 100644 index 0000000000..09fd6e9014 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Extensions/project.json @@ -0,0 +1,41 @@ +{ + "description": "Extensions to the core MVC runtime", + "version": "6.0.0-*", + "compilationOptions": { + "warningsAsErrors": true + }, + "dependencies": { + "Microsoft.AspNet.Authentication": "1.0.0-*", + "Microsoft.AspNet.Authorization": "1.0.0-*", + "Microsoft.AspNet.Cors.Core": "1.0.0-*", + "Microsoft.AspNet.DataProtection": "1.0.0-*", + "Microsoft.AspNet.Diagnostics.Abstractions": "1.0.0-*", + "Microsoft.AspNet.FileProviders.Abstractions": "1.0.0-*", + "Microsoft.AspNet.JsonPatch": "1.0.0-*", + "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, + "Microsoft.AspNet.Mvc.Core": "6.0.0-*", + "Microsoft.Framework.BufferEntryCollection.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.CopyOnWriteDictionary.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.PropertyActivator.Sources": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" }, + "Newtonsoft.Json": "6.0.6" + }, + + "frameworks": { + "dnx451": { + "frameworkAssemblies": { + "System.ComponentModel.DataAnnotations": "", + "System.Runtime.Serialization": "" + } + }, + "dnxcore50": { + "dependencies": { + "System.ComponentModel.Annotations": "4.0.10-beta-*", + "System.Runtime.Serialization.Primitives": "4.0.10-beta-*", + "Microsoft.CSharp": "4.0.0-beta-*" + } + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.Razor/project.json b/src/Microsoft.AspNet.Mvc.Razor/project.json index 8d0534f949..be34951f82 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/project.json +++ b/src/Microsoft.AspNet.Mvc.Razor/project.json @@ -7,7 +7,7 @@ "dependencies": { "Microsoft.AspNet.Diagnostics.Abstractions": "1.0.0-*", "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, - "Microsoft.AspNet.Mvc.Core": "6.0.0-*", + "Microsoft.AspNet.Mvc.Extensions": "6.0.0-*", "Microsoft.AspNet.Mvc.Razor.Host": "6.0.0-*", "Microsoft.AspNet.PageExecutionInstrumentation.Interfaces": "1.0.0-*", "Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" }, diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json index 8b640768fd..a16a280298 100644 --- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json +++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json @@ -6,7 +6,7 @@ }, "dependencies": { "Microsoft.AspNet.Mvc.Common": { "type": "build", "version": "6.0.0-*" }, - "Microsoft.AspNet.Mvc.Core": "6.0.0-*", + "Microsoft.AspNet.Mvc.Extensions": "6.0.0-*", "Microsoft.AspNet.WebApi.Client": "5.2.2", "Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" } diff --git a/src/Microsoft.AspNet.Mvc.Xml/project.json b/src/Microsoft.AspNet.Mvc.Xml/project.json index 1281914135..fe20f7002a 100644 --- a/src/Microsoft.AspNet.Mvc.Xml/project.json +++ b/src/Microsoft.AspNet.Mvc.Xml/project.json @@ -6,7 +6,7 @@ }, "dependencies": { "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, - "Microsoft.AspNet.Mvc.Core": "6.0.0-*", + "Microsoft.AspNet.Mvc.Extensions": "6.0.0-*", "Microsoft.Framework.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" } diff --git a/src/Microsoft.AspNet.Mvc/JsonMvcFormatterMappingOptionsSetup.cs b/src/Microsoft.AspNet.Mvc/JsonMvcFormatterMappingOptionsSetup.cs new file mode 100644 index 0000000000..1679640f0b --- /dev/null +++ b/src/Microsoft.AspNet.Mvc/JsonMvcFormatterMappingOptionsSetup.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Framework.OptionsModel; +using Microsoft.Net.Http.Headers; + +namespace Microsoft.AspNet.Mvc +{ + public class JsonMvcFormatterMappingOptionsSetup : ConfigureOptions + { + public JsonMvcFormatterMappingOptionsSetup() + : base(ConfigureMvc) + { + Order = DefaultOrder.DefaultFrameworkSortOrder + 10; + } + + public static void ConfigureMvc(MvcFormatterMappingOptions options) + { + options.FormatterMappings.SetMediaTypeMappingForFormat("json", MediaTypeHeaderValue.Parse("application/json")); + } + } +} diff --git a/src/Microsoft.AspNet.Mvc/JsonMvcOptionsSetup.cs b/src/Microsoft.AspNet.Mvc/JsonMvcOptionsSetup.cs new file mode 100644 index 0000000000..f186ac9aba --- /dev/null +++ b/src/Microsoft.AspNet.Mvc/JsonMvcOptionsSetup.cs @@ -0,0 +1,25 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Framework.OptionsModel; +using Newtonsoft.Json; + +namespace Microsoft.AspNet.Mvc +{ + public class JsonMvcOptionsSetup : ConfigureOptions + { + public JsonMvcOptionsSetup(IOptions jsonOptions) + : base((_) => ConfigureMvc(_, jsonOptions.Options.SerializerSettings)) + { + Order = DefaultOrder.DefaultFrameworkSortOrder + 10; + } + + public static void ConfigureMvc(MvcOptions options, JsonSerializerSettings serializerSettings) + { + options.OutputFormatters.Add(new JsonOutputFormatter(serializerSettings)); + + options.InputFormatters.Add(new JsonInputFormatter(serializerSettings)); + options.InputFormatters.Add(new JsonPatchInputFormatter(serializerSettings)); + } + } +} diff --git a/src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs b/src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs index f75df92f12..1aa4ce26b9 100644 --- a/src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs +++ b/src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs @@ -6,7 +6,6 @@ using System.Xml.Linq; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Metadata; using Microsoft.AspNet.Mvc.ModelBinding.Validation; -using Microsoft.AspNet.Mvc.Razor; using Microsoft.Framework.OptionsModel; using Microsoft.Net.Http.Headers; using Newtonsoft.Json.Linq; @@ -18,17 +17,14 @@ namespace Microsoft.AspNet.Mvc /// public class MvcOptionsSetup : ConfigureOptions { - public MvcOptionsSetup() : base(ConfigureMvc) + public MvcOptionsSetup() + : base(ConfigureMvc) { Order = DefaultOrder.DefaultFrameworkSortOrder; } - /// public static void ConfigureMvc(MvcOptions options) { - // Set up ViewEngines - options.ViewEngines.Add(typeof(RazorViewEngine)); - // Set up ModelBinding options.ModelBinders.Add(new BinderTypeBasedModelBinder()); options.ModelBinders.Add(new ServicesModelBinder()); @@ -48,14 +44,6 @@ namespace Microsoft.AspNet.Mvc options.OutputFormatters.Add(new HttpNoContentOutputFormatter()); options.OutputFormatters.Add(new StringOutputFormatter()); options.OutputFormatters.Add(new StreamOutputFormatter()); - options.OutputFormatters.Add(new JsonOutputFormatter(options.SerializerSettings)); - - // Set up default mapping for json extensions to content type - options.FormatterMappings.SetMediaTypeMappingForFormat("json", MediaTypeHeaderValue.Parse("application/json")); - - // Set up default input formatters. - options.InputFormatters.Add(new JsonInputFormatter(options.SerializerSettings)); - options.InputFormatters.Add(new JsonPatchInputFormatter(options.SerializerSettings)); // Set up ValueProviders options.ValueProviderFactories.Add(new RouteValueValueProviderFactory()); @@ -72,10 +60,6 @@ namespace Microsoft.AspNet.Mvc options.ModelValidatorProviders.Add(new DefaultModelValidatorProvider()); options.ModelValidatorProviders.Add(new DataAnnotationsModelValidatorProvider()); - // Set up client validators - options.ClientModelValidatorProviders.Add(new DefaultClientModelValidatorProvider()); - options.ClientModelValidatorProviders.Add(new DataAnnotationsClientModelValidatorProvider()); - // Add types to be excluded from Validation options.ValidationExcludeFilters.Add(new SimpleTypesExcludeFilter()); options.ValidationExcludeFilters.Add(typeof(XObject)); diff --git a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs index af55d6cfbd..3ec3e18080 100644 --- a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs @@ -39,6 +39,18 @@ namespace Microsoft.Framework.DependencyInjection return services; } + /// + /// Configures a set of for the application. + /// + /// The services available in the application. + /// The which need to be configured. + public static void ConfigureAntiforgery( + [NotNull] this IServiceCollection services, + [NotNull] Action setupAction) + { + services.Configure(setupAction); + } + /// /// Configures a set of for the application. /// @@ -51,6 +63,54 @@ namespace Microsoft.Framework.DependencyInjection services.Configure(setupAction); } + /// + /// Configures a set of for the application. + /// + /// The services available in the application. + /// The which need to be configured. + public static void ConfigureMvcCaching( + [NotNull] this IServiceCollection services, + [NotNull] Action setupAction) + { + services.Configure(setupAction); + } + + /// + /// Configures a set of for the application. + /// + /// The services available in the application. + /// The which need to be configured. + public static void ConfigureMvcFormatterMappings( + [NotNull] this IServiceCollection services, + [NotNull] Action setupAction) + { + services.Configure(setupAction); + } + + /// + /// Configures a set of for the application. + /// + /// The services available in the application. + /// The which need to be configured. + public static void ConfigureMvcJson( + [NotNull] this IServiceCollection services, + [NotNull] Action setupAction) + { + services.Configure(setupAction); + } + + /// + /// Configures a set of for the application. + /// + /// The services available in the application. + /// The which need to be configured. + public static void ConfigureMvcViews( + [NotNull] this IServiceCollection services, + [NotNull] Action setupAction) + { + services.Configure(setupAction); + } + /// /// Register the specified as services and as a source for controller /// discovery. @@ -102,10 +162,11 @@ namespace Microsoft.Framework.DependencyInjection // To enable unit testing internal static void AddMvcServices(IServiceCollection services) { - // Options and core services. - // multiple registration service + // Options - all of these are multi-registration services.AddTransient, MvcOptionsSetup>(); - // multiple registration service + services.AddTransient, JsonMvcOptionsSetup>(); + services.AddTransient, JsonMvcFormatterMappingOptionsSetup>(); + services.AddTransient, MvcViewOptionsSetup>(); services.AddTransient, RazorViewEngineOptionsSetup>(); services.TryAdd(ServiceDescriptor.Transient()); @@ -159,6 +220,13 @@ namespace Microsoft.Framework.DependencyInjection // multiple registration service services.AddTransient(); + // multiple registration services + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.TryAdd(ServiceDescriptor.Transient()); services.TryAdd(ServiceDescriptor.Transient()); @@ -175,7 +243,7 @@ namespace Microsoft.Framework.DependencyInjection // JsonOutputFormatter should use the SerializerSettings on MvcOptions services.TryAdd(ServiceDescriptor.Singleton(serviceProvider => { - var options = serviceProvider.GetRequiredService>().Options; + var options = serviceProvider.GetRequiredService>().Options; return new JsonOutputFormatter(options.SerializerSettings); })); diff --git a/src/Microsoft.AspNet.Mvc/MvcViewOptionsSetup.cs b/src/Microsoft.AspNet.Mvc/MvcViewOptionsSetup.cs new file mode 100644 index 0000000000..13367ff16d --- /dev/null +++ b/src/Microsoft.AspNet.Mvc/MvcViewOptionsSetup.cs @@ -0,0 +1,31 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNet.Mvc.ModelBinding.Validation; +using Microsoft.AspNet.Mvc.Razor; +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Mvc +{ + /// + /// Sets up default options for . + /// + public class MvcViewOptionsSetup : ConfigureOptions + { + public MvcViewOptionsSetup() + : base(ConfigureMvc) + { + Order = DefaultOrder.DefaultFrameworkSortOrder; + } + + public static void ConfigureMvc(MvcViewOptions options) + { + // Set up ViewEngines + options.ViewEngines.Add(typeof(RazorViewEngine)); + + // Set up client validators + options.ClientModelValidatorProviders.Add(new DefaultClientModelValidatorProvider()); + options.ClientModelValidatorProviders.Add(new DataAnnotationsClientModelValidatorProvider()); + } + } +} diff --git a/src/Microsoft.AspNet.Mvc/project.json b/src/Microsoft.AspNet.Mvc/project.json index 3abcb432c1..f166553ae3 100644 --- a/src/Microsoft.AspNet.Mvc/project.json +++ b/src/Microsoft.AspNet.Mvc/project.json @@ -8,6 +8,7 @@ "Microsoft.AspNet.Authorization": "1.0.0-*", "Microsoft.AspNet.Cors": "1.0.0-*", "Microsoft.AspNet.Mvc.ApiExplorer": "6.0.0-*", + "Microsoft.AspNet.Mvc.Extensions": "6.0.0-*", "Microsoft.AspNet.Mvc.Razor": "6.0.0-*", "Microsoft.Framework.Caching.Memory": "1.0.0-*", "Microsoft.Framework.DependencyInjection": "1.0.0-*", diff --git a/test/Microsoft.AspNet.Mvc.Abstractions.Test/project.json b/test/Microsoft.AspNet.Mvc.Abstractions.Test/project.json index e757115428..a50083190c 100644 --- a/test/Microsoft.AspNet.Mvc.Abstractions.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.Abstractions.Test/project.json @@ -4,7 +4,6 @@ }, "dependencies": { "Microsoft.AspNet.Mvc" : "6.0.0-*", - "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Testing": "1.0.0-*", "Moq": "4.2.1312.1622", "xunit.runner.aspnet": "2.0.0-aspnet-*" diff --git a/test/Microsoft.AspNet.Mvc.Common.Test/TypeHelperTest.cs b/test/Microsoft.AspNet.Mvc.Common.Test/TypeHelperTest.cs index 38dca7955a..75e5b26062 100644 --- a/test/Microsoft.AspNet.Mvc.Common.Test/TypeHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.Common.Test/TypeHelperTest.cs @@ -65,5 +65,155 @@ namespace Microsoft.AspNet.Mvc private class Foo { } + + public static TheoryData> IgnoreCaseTestData + { + get + { + return new TheoryData> + { + { + new + { + selected = true, + SeLeCtEd = false + }, + new KeyValuePair("selected", false) + }, + { + new + { + SeLeCtEd = false, + selected = true + }, + new KeyValuePair("SeLeCtEd", true) + }, + { + new + { + SelECTeD = false, + SeLECTED = true + }, + new KeyValuePair("SelECTeD", true) + } + }; + } + } + + [Theory] + [MemberData(nameof(IgnoreCaseTestData))] + public void ObjectToDictionary_IgnoresPropertyCase(object testObject, + KeyValuePair expectedEntry) + { + // Act + var result = TypeHelper.ObjectToDictionary(testObject); + + // Assert + var entry = Assert.Single(result); + Assert.Equal(expectedEntry, entry); + } + + [Fact] + public void ObjectToDictionary_WithNullObject_ReturnsEmptyDictionary() + { + // Arrange + object value = null; + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(0, dictValues.Count); + } + + [Fact] + public void ObjectToDictionary_WithPlainObjectType_ReturnsEmptyDictionary() + { + // Arrange + var value = new object(); + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(0, dictValues.Count); + } + + [Fact] + public void ObjectToDictionary_WithPrimitiveType_LooksUpPublicProperties() + { + // Arrange + var value = "test"; + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(1, dictValues.Count); + Assert.Equal(4, dictValues["Length"]); + } + + [Fact] + public void ObjectToDictionary_WithAnonymousType_LooksUpProperties() + { + // Arrange + var value = new { test = "value", other = 1 }; + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(2, dictValues.Count); + Assert.Equal("value", dictValues["test"]); + Assert.Equal(1, dictValues["other"]); + } + + [Fact] + public void ObjectToDictionary_ReturnsCaseInsensitiveDictionary() + { + // Arrange + var value = new { TEST = "value", oThEr = 1 }; + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(2, dictValues.Count); + Assert.Equal("value", dictValues["test"]); + Assert.Equal(1, dictValues["other"]); + } + + [Fact] + public void ObjectToDictionary_ReturnsInheritedProperties() + { + // Arrange + var value = new ThreeDPoint() { X = 5, Y = 10, Z = 17 }; + + // Act + var dictValues = TypeHelper.ObjectToDictionary(value); + + // Assert + Assert.NotNull(dictValues); + Assert.Equal(3, dictValues.Count); + Assert.Equal(5, dictValues["X"]); + Assert.Equal(10, dictValues["Y"]); + Assert.Equal(17, dictValues["Z"]); + } + + private class Point + { + public int X { get; set; } + public int Y { get; set; } + } + + private class ThreeDPoint : Point + { + public int Z { get; set; } + } } } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionApplicationModelConventionTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionApplicationModelConventionTest.cs index 0609cb683d..0836ceb6d2 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionApplicationModelConventionTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionApplicationModelConventionTest.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels } } - private class HelloController : Controller + private class HelloController { public string GetHello() { @@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels } } - private class WorldController : Controller + private class WorldController { public string GetWorld() { diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionModelTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionModelTest.cs index b169eaaba6..0f3e620ac7 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionModelTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ActionModelTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using Microsoft.AspNet.Authorization; using Xunit; namespace Microsoft.AspNet.Mvc.ApplicationModels @@ -43,17 +42,22 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void CopyConstructor_CopiesAllProperties() { // Arrange - var action = new ActionModel(typeof(TestController).GetMethod("Edit"), - new List() { new HttpGetAttribute(), new AuthorizeAttribute() }); + var action = new ActionModel( + typeof(TestController).GetMethod("Edit"), + new List() + { + new HttpGetAttribute(), + new MyFilterAttribute(), + }); action.ActionConstraints.Add(new HttpMethodConstraint(new string[] { "GET" })); action.ActionName = "Edit"; action.Controller = new ControllerModel(typeof(TestController).GetTypeInfo(), new List()); - action.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("whatever").Build())); + action.Filters.Add(new MyFilterAttribute()); action.HttpMethods.Add("GET"); - action.RouteConstraints.Add(new AreaAttribute("Admin")); + action.RouteConstraints.Add(new MyRouteConstraintAttribute()); action.Properties.Add(new KeyValuePair("test key", "test value")); // Act @@ -112,5 +116,20 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { } } + + private class MyFilterAttribute : Attribute, IFilter + { + } + + private class MyRouteConstraintAttribute : Attribute, IRouteConstraintProvider + { + public bool BlockNonAttributedActions { get { return true; } } + + public string RouteKey { get; set; } + + public RouteKeyHandling RouteKeyHandling { get { return RouteKeyHandling.RequireKey; } } + + public string RouteValue { get; set; } + } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerApplicationModelConventionTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerApplicationModelConventionTest.cs index 13113317a0..a96f1dd820 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerApplicationModelConventionTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerApplicationModelConventionTest.cs @@ -31,8 +31,8 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels } } - private class HelloController : Controller { } - private class WorldController : Controller { } + private class HelloController { } + private class WorldController { } private class SimpleControllerConvention : IControllerModelConvention { diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerModelTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerModelTest.cs index 89266a874b..f90ca4c81b 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerModelTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/ControllerModelTest.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using Microsoft.AspNet.Authorization; using Xunit; namespace Microsoft.AspNet.Mvc.ApplicationModels @@ -49,14 +48,19 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void CopyConstructor_CopiesAllProperties() { // Arrange - var controller = new ControllerModel(typeof(TestController).GetTypeInfo(), - new List() { new HttpGetAttribute(), new AuthorizeAttribute() }); + var controller = new ControllerModel( + typeof(TestController).GetTypeInfo(), + new List() + { + new HttpGetAttribute(), + new MyFilterAttribute(), + }); controller.ActionConstraints.Add(new HttpMethodConstraint(new string[] { "GET" })); controller.Application = new ApplicationModel(); controller.ControllerName = "cool"; - controller.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("whatever").Build())); - controller.RouteConstraints.Add(new AreaAttribute("Admin")); + controller.Filters.Add(new MyFilterAttribute()); + controller.RouteConstraints.Add(new MyRouteConstraintAttribute()); controller.Properties.Add(new KeyValuePair("test key", "test value")); controller.ControllerProperties.Add( new PropertyModel(typeof(TestController).GetProperty("TestProperty"), new List())); @@ -119,5 +123,20 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { } } + + private class MyFilterAttribute : Attribute, IFilter + { + } + + private class MyRouteConstraintAttribute : Attribute, IRouteConstraintProvider + { + public bool BlockNonAttributedActions { get { return true; } } + + public string RouteKey { get; set; } + + public RouteKeyHandling RouteKeyHandling { get { return RouteKeyHandling.RequireKey; } } + + public string RouteValue { get; set; } + } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultApplicationModelProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultApplicationModelProviderTest.cs index b77f215a9e..06841ed324 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultApplicationModelProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ApplicationModel/DefaultApplicationModelProviderTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Cors.Core; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.ModelBinding; @@ -33,34 +32,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels Assert.IsType(filter); } - [Fact] - public void CreateControllerModel_AuthorizeAttributeAddsAuthorizeFilter() - { - // Arrange - var builder = new TestApplicationModelProvider(); - var typeInfo = typeof(AccountController).GetTypeInfo(); - - // Act - var model = builder.CreateControllerModel(typeInfo); - - // Assert - Assert.True(model.Filters.Any(f => f is AuthorizeFilter)); - } - - [Fact] - public void CreateControllerModel_EnableCorsAttributeAddsCorsAuthorizationFilterFactory() - { - // Arrange - var builder = new TestApplicationModelProvider(); - var typeInfo = typeof(CorsController).GetTypeInfo(); - - // Act - var model = builder.CreateControllerModel(typeInfo); - - // Assert - Assert.Single(model.Filters, f => f is CorsAuthorizationFilterFactory); - } - [Fact] public void OnProvidersExecuting_AddsControllerProperties() { @@ -83,20 +54,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels Assert.IsType(attribute); } - [Fact] - public void CreateControllerModel_DisableCorsAttributeAddsDisableCorsAuthorizationFilter() - { - // Arrange - var builder = new TestApplicationModelProvider(); - var typeInfo = typeof(DisableCorsController).GetTypeInfo(); - - // Act - var model = builder.CreateControllerModel(typeInfo); - - // Assert - Assert.True(model.Filters.Any(f => f is DisableCorsAuthorizationFilter)); - } - // This class has a filter attribute, but doesn't implement any filter interfaces, // so ControllerFilter is not present. [Fact] @@ -111,7 +68,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels // Assert var filter = Assert.Single(model.Filters); - Assert.IsType(filter); + Assert.IsType(filter); } [Fact] @@ -454,38 +411,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels Assert.False(isValid); } - [Fact] - public void BuildActionModel_EnableCorsAttributeAddsCorsAuthorizationFilterFactory() - { - // Arrange - var builder = new TestApplicationModelProvider(); - var typeInfo = typeof(EnableCorsController).GetTypeInfo(); - var method = typeInfo.GetMethod("Action"); - - // Act - var actions = builder.BuildActionModels(typeInfo, method); - - // Assert - var action = Assert.Single(actions); - Assert.Single(action.Filters, f => f is CorsAuthorizationFilterFactory); - } - - [Fact] - public void BuildActionModel_DisableCorsAttributeAddsDisableCorsAuthorizationFilter() - { - // Arrange - var builder = new TestApplicationModelProvider(); - var typeInfo = typeof(DisableCorsActionController).GetTypeInfo(); - var method = typeInfo.GetMethod("Action"); - - // Act - var actions = builder.BuildActionModels(typeInfo, method); - - // Assert - var action = Assert.Single(actions); - Assert.True(action.Filters.Any(f => f is DisableCorsAuthorizationFilter)); - } - [Fact] public void BuildActionModels_ConventionallyRoutedAction_WithoutHttpConstraints() { @@ -526,29 +451,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels Assert.IsType(Assert.Single(action.Attributes)); } - [Fact] - public void BuildActionModels_BaseAuthorizeFiltersAreStillValidWhenOverriden() - { - // Arrange - var builder = new TestApplicationModelProvider(); - builder.AuthorizationOptions.AddPolicy("Base", policy => policy.RequireClaim("Basic").RequireClaim("Basic2")); - builder.AuthorizationOptions.AddPolicy("Derived", policy => policy.RequireClaim("Derived")); - - var typeInfo = typeof(DerivedController).GetTypeInfo(); - var actionName = nameof(DerivedController.Authorize); - - // Act - var actions = builder.BuildActionModels(typeInfo, typeInfo.GetMethod(actionName)); - - // Assert - var action = Assert.Single(actions); - Assert.Equal("Authorize", action.ActionName); - Assert.Null(action.AttributeRouteModel); - var authorizeFilters = action.Filters.OfType(); - Assert.Single(authorizeFilters); - Assert.Equal(3, authorizeFilters.First().Policy.Requirements.Count); - } - [Fact] public void BuildActionModels_ConventionallyRoutedActionWithHttpConstraints_AndInvalidRouteTemplateProvider() { @@ -946,6 +848,20 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels } } + private class Controller : IDisposable + { + public void Dispose() + { + throw new NotImplementedException(); + } + + [NonAction] + public virtual IActionResult Redirect(string url) + { + return null; + } + } + private class BaseController : Controller { public void GetFromBase() // Valid action method. @@ -962,16 +878,10 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { } - public override RedirectResult Redirect(string url) + public override IActionResult Redirect(string url) { return base.Redirect(url + "#RedirectOverride"); } - - [Authorize(Policy = "Base")] - public virtual void Authorize() - { - } - } private class DerivedController : BaseController @@ -989,12 +899,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { } - [Authorize(Policy = "Derived")] - public override void Authorize() - { - } - - public void GenericMethod() { } @@ -1090,7 +994,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels } } - private class OperatorOverloadingController : Mvc.Controller + private class OperatorOverloadingController : Controller { public static OperatorOverloadingController operator +( OperatorOverloadingController c1, @@ -1175,22 +1079,6 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels public void Invalid() { } } - private class EnableCorsController - { - [EnableCors("policy")] - public void Action() - { - } - } - - private class DisableCorsActionController - { - [DisableCors] - public void Action() - { - } - } - // Here the constraints on the methods are acting as an IActionHttpMethodProvider and // not as an IRouteTemplateProvider given that there is no RouteAttribute // on the controller and the template for all the constraints on a method is null. @@ -1248,30 +1136,28 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels { } - private class StoreController : Mvc.Controller + private class StoreController : Controller, IActionFilter + { + public void OnActionExecuted(ActionExecutedContext context) + { + throw new NotImplementedException(); + } + + public void OnActionExecuting(ActionExecutingContext context) + { + throw new NotImplementedException(); + } + } + + private class MyFilterAttribute : Attribute, IFilter { } - [Produces("application/json")] + [MyFilter] public class NoFiltersController { } - [Authorize] - public class AccountController - { - } - - [EnableCors("policy")] - public class CorsController - { - } - - [DisableCors] - public class DisableCorsController - { - } - public class ModelBinderController { [FromQuery] @@ -1319,23 +1205,17 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels private class TestApplicationModelProvider : DefaultApplicationModelProvider { public TestApplicationModelProvider() - : this( - new MockMvcOptionsAccessor(), - new OptionsManager(Enumerable.Empty>())) + : this(new MockMvcOptionsAccessor()) { } public TestApplicationModelProvider( - IOptions options, - IOptions authorizationOptions) - : base(options, authorizationOptions) + IOptions options) + : base(options) { Options = options.Options; - AuthorizationOptions = authorizationOptions.Options; } - public AuthorizationOptions AuthorizationOptions { get; } - public MvcOptions Options { get; } public new IEnumerable BuildControllerModels(TypeInfo typeInfo) diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionArgumentBinderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionArgumentBinderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs index 4515f0ef7e..136f544ddf 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionDescriptorProviderTests.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Mvc.ApiExplorer; using Microsoft.AspNet.Mvc.ApplicationModels; using Microsoft.AspNet.Mvc.Core; @@ -1460,7 +1459,7 @@ namespace Microsoft.AspNet.Mvc.Test } var controllerTypeProvider = new FixedSetControllerTypeProvider(new[] { controllerTypeInfo }); - var modelProvider = new DefaultApplicationModelProvider(options, new MockAuthorizationOptionsAccessor()); + var modelProvider = new DefaultApplicationModelProvider(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, @@ -1476,7 +1475,7 @@ namespace Microsoft.AspNet.Mvc.Test var options = new MockMvcOptionsAccessor(); var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypeInfos); - var modelProvider = new DefaultApplicationModelProvider(options, new MockAuthorizationOptionsAccessor()); + var modelProvider = new DefaultApplicationModelProvider(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, @@ -1494,7 +1493,7 @@ namespace Microsoft.AspNet.Mvc.Test options.Options.Conventions.Add(convention); var controllerTypeProvider = new FixedSetControllerTypeProvider(new[] { controllerTypeInfo }); - var modelProvider = new DefaultApplicationModelProvider(options, new MockAuthorizationOptionsAccessor()); + var modelProvider = new DefaultApplicationModelProvider(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, @@ -1808,7 +1807,7 @@ namespace Microsoft.AspNet.Mvc.Test [Route("Product")] [Route("/Product")] [Route("/product")] - public class DuplicatedAttributeRouteController : Controller + public class DuplicatedAttributeRouteController { [HttpGet("/List")] [HttpGet("/List")] @@ -1822,7 +1821,7 @@ namespace Microsoft.AspNet.Mvc.Test } [Route("Products")] - public class NonDuplicatedAttributeRouteController : Controller + public class NonDuplicatedAttributeRouteController { [HttpGet("list")] public void ControllerAndAction() { } @@ -2032,7 +2031,7 @@ namespace Microsoft.AspNet.Mvc.Test } [ApiExplorerSettings(GroupName = "Default")] - private class ApiExplorerEnabledConventionalRoutedController : Controller + private class ApiExplorerEnabledConventionalRoutedController { public void A() { @@ -2040,7 +2039,7 @@ namespace Microsoft.AspNet.Mvc.Test } [ApiExplorerSettings(IgnoreApi = true)] - private class ApiExplorerEnabledActionConventionalRoutedController : Controller + private class ApiExplorerEnabledActionConventionalRoutedController { [ApiExplorerSettings(GroupName = "Default")] public void A() diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs index afd10e26ff..c221e5bc76 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs @@ -18,6 +18,7 @@ using Microsoft.Framework.Internal; using Microsoft.Framework.Logging; using Microsoft.Framework.Logging.Testing; using Microsoft.Framework.OptionsModel; +using Microsoft.Net.Http.Headers; using Moq; using Xunit; @@ -28,7 +29,7 @@ namespace Microsoft.AspNet.Mvc // Intentionally choosing an uncommon exception type. private readonly Exception _actionException = new TimeZoneNotFoundException(); - private readonly JsonResult _result = new JsonResult(new { message = "Hello, world!" }); + private readonly ContentResult _result = new ContentResult() { Content = "Hello, world!" }; private struct SampleStruct { @@ -964,7 +965,7 @@ namespace Microsoft.AspNet.Mvc Times.Once()); Assert.True(context.Canceled); - Assert.IsType(context.Result); + Assert.IsType(context.Result); } [Fact] @@ -1006,7 +1007,7 @@ namespace Microsoft.AspNet.Mvc Times.Once()); Assert.True(context.Canceled); - Assert.IsType(context.Result); + Assert.IsType(context.Result); } [Fact] @@ -2022,14 +2023,28 @@ namespace Microsoft.AspNet.Mvc httpResponse.Body = new MemoryStream(); + var formatter = new Mock(); + formatter + .Setup(f => f.CanWriteResult(It.IsAny(), It.IsAny())) + .Returns(true); + + formatter + .Setup(f => f.WriteAsync(It.IsAny())) + .Returns(async c => + { + await c.HttpContext.Response.WriteAsync(c.Object.ToString()); + }); + var options = new MvcOptions(); - options.OutputFormatters.Add(new JsonOutputFormatter()); + options.OutputFormatters.Add(formatter.Object); var optionsAccessor = new Mock>(); - optionsAccessor.SetupGet(o => o.Options) + optionsAccessor + .SetupGet(o => o.Options) .Returns(options); - httpContext.Setup(o => o.RequestServices.GetService(typeof(IOptions))) + httpContext + .Setup(o => o.RequestServices.GetService(typeof(IOptions))) .Returns(optionsAccessor.Object); var actionContext = new ActionContext( @@ -2059,7 +2074,7 @@ namespace Microsoft.AspNet.Mvc new[] { filterProvider.Object }, new MockControllerFactory(this), actionDescriptor, - new InputFormatter[0], + new IInputFormatter[0], new IOutputFormatter[0], Mock.Of(), new IModelBinder[0], @@ -2140,19 +2155,19 @@ namespace Microsoft.AspNet.Mvc Assert.Equal(5, context.Object.Items["Result"]); } - public JsonResult ActionMethod() + public IActionResult ActionMethod() { return _result; } - public JsonResult ThrowingActionMethod() + public ObjectResult ThrowingActionMethod() { throw _actionException; } - public JsonResult ActionMethodWithBodyParameter([FromBody] Person bodyParam) + public IActionResult ActionMethodWithBodyParameter([FromBody] Person bodyParam) { - return new JsonResult(bodyParam); + return new ObjectResult(bodyParam); } public class Person diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs index f428de3188..67de732419 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultActionSelectorTests.cs @@ -7,7 +7,6 @@ using System.ComponentModel.Design; using System.Linq; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.ActionConstraints; @@ -671,7 +670,7 @@ namespace Microsoft.AspNet.Mvc var options = new MockMvcOptionsAccessor(); var controllerTypeProvider = new FixedSetControllerTypeProvider(controllerTypes); - var modelProvider = new DefaultApplicationModelProvider(options, new MockAuthorizationOptionsAccessor()); + var modelProvider = new DefaultApplicationModelProvider(options); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs index 369d544221..957b444396 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs @@ -61,6 +61,10 @@ namespace Microsoft.AspNet.Mvc serviceProvider.Verify(); } + public class Controller + { + } + private class TypeDerivingFromController : Controller { } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerFactoryTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerFactoryTest.cs index 9156f8ae56..06e3083ddc 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerFactoryTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerFactoryTest.cs @@ -20,10 +20,11 @@ namespace Microsoft.AspNet.Mvc.Core public void CreateController_ThrowsIfActionDescriptorIsNotControllerActionDescriptor() { // Arrange - var expected = "The action descriptor must be of type 'Microsoft.AspNet.Mvc.ControllerActionDescriptor'." + - Environment.NewLine + "Parameter name: actionContext"; + var expected = + "The action descriptor must be of type 'Microsoft.AspNet.Mvc.ControllerActionDescriptor'." + + Environment.NewLine + "Parameter name: actionContext"; var actionDescriptor = new ActionDescriptor(); - var controllerFactory = new DefaultControllerFactory(Mock.Of()); + var controllerFactory = CreateControllerFactory(); var httpContext = new DefaultHttpContext(); var actionContext = new ActionContext(httpContext, new RouteData(), @@ -55,7 +56,7 @@ namespace Microsoft.AspNet.Mvc.Core .Returns(expected) .Verifiable(); - var controllerFactory = new DefaultControllerFactory(activator.Object); + var controllerFactory = CreateControllerFactory(activator.Object); // Act var result = controllerFactory.CreateController(actionContext); @@ -80,7 +81,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act var result = factory.CreateController(context); @@ -90,31 +91,6 @@ namespace Microsoft.AspNet.Mvc.Core Assert.Same(context, controller.ActionContext); } - [Fact] - public void CreateController_SetsViewDataDictionary() - { - // Arrange - var actionDescriptor = new ControllerActionDescriptor - { - ControllerTypeInfo = typeof(ControllerWithAttributes).GetTypeInfo() - }; - - var services = GetServices(); - var httpContext = new DefaultHttpContext - { - RequestServices = services - }; - var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); - - // Act - var result = factory.CreateController(context); - - // Assert - var controller = Assert.IsType(result); - Assert.NotNull(controller.ViewData); - } - [Fact] public void CreateController_SetsBindingContext() { @@ -132,7 +108,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act var result = factory.CreateController(context); @@ -156,7 +132,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act var result = factory.CreateController(context); @@ -180,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act var result = factory.CreateController(context); @@ -192,7 +168,7 @@ namespace Microsoft.AspNet.Mvc.Core } [Fact] - public void CreateController_ThrowsIfPropertyCannotBeActivated() + public void CreateController_ThrowsIConstructorCannotBeActivated() { // Arrange var actionDescriptor = new ControllerActionDescriptor @@ -205,7 +181,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act and Assert var exception = Assert.Throws(() => factory.CreateController(context)); @@ -233,7 +209,7 @@ namespace Microsoft.AspNet.Mvc.Core RequestServices = services }; var context = new ActionContext(httpContext, new RouteData(), actionDescriptor); - var factory = new DefaultControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); + var factory = CreateControllerFactory(new DefaultControllerActivator(new DefaultTypeActivatorCache())); // Act and Assert var exception = Assert.Throws(() => factory.CreateController(context)); @@ -247,7 +223,7 @@ namespace Microsoft.AspNet.Mvc.Core public void DefaultControllerFactory_DisposesIDisposableController() { // Arrange - var factory = new DefaultControllerFactory(Mock.Of()); + var factory = CreateControllerFactory(); var controller = new MyController(); // Act + Assert @@ -262,7 +238,7 @@ namespace Microsoft.AspNet.Mvc.Core public void DefaultControllerFactory_ReleasesNonIDisposableController() { // Arrange - var factory = new DefaultControllerFactory(Mock.Of()); + var factory = CreateControllerFactory(); var controller = new object(); // Act + Assert (does not throw) @@ -287,13 +263,22 @@ namespace Microsoft.AspNet.Mvc.Core return services.Object; } + private static DefaultControllerFactory CreateControllerFactory(IControllerActivator controllerActivator = null) + { + controllerActivator = controllerActivator ?? Mock.Of(); + var propertyActivators = new IControllerPropertyActivator[] + { + new DefaultControllerPropertyActivator(), + }; + + return new DefaultControllerFactory(controllerActivator, propertyActivators); + } + private class ControllerWithoutAttributes { public ActionContext ActionContext { get; set; } public ActionBindingContext BindingContext { get; set; } - - public ViewDataDictionary ViewData { get; set; } } public class ControllerWithNonVisibleProperties @@ -310,16 +295,13 @@ namespace Microsoft.AspNet.Mvc.Core [ActionBindingContext] public ActionBindingContext BindingContext { get; set; } - - [ViewDataDictionary] - public ViewDataDictionary ViewData { get; set; } } - private class MyController : Controller + private class MyController : IDisposable { public bool Disposed { get; set; } - protected override void Dispose(bool disposing) + public void Dispose() { Disposed = true; } @@ -337,22 +319,22 @@ namespace Microsoft.AspNet.Mvc.Core private class TestService { + } + private class Controller + { } private class OpenGenericType : Controller { - } private abstract class AbstractType : Controller { - } private interface InterfaceType { - } } } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerTypeProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerTypeProviderTest.cs index 6f216451f4..6dbd90c07d 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerTypeProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerTypeProviderTest.cs @@ -234,7 +234,7 @@ namespace Microsoft.AspNet.Mvc // independent. namespace Microsoft.AspNet.Mvc.DefaultControllerTypeProviderControllers { - public abstract class AbstractController : Mvc.Controller + public abstract class AbstractController : Controller { } @@ -242,7 +242,7 @@ namespace Microsoft.AspNet.Mvc.DefaultControllerTypeProviderControllers { } - public class StoreController : Mvc.Controller + public class StoreController : Controller { } @@ -250,7 +250,7 @@ namespace Microsoft.AspNet.Mvc.DefaultControllerTypeProviderControllers { } - public class OpenGenericController : Mvc.Controller + public class OpenGenericController : Controller { } @@ -262,7 +262,7 @@ namespace Microsoft.AspNet.Mvc.DefaultControllerTypeProviderControllers { } - public class NoSuffix : Mvc.Controller + public class NoSuffix : Controller { } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/DefaultFilterProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultFilterProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/DefaultFilterProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/DefaultFilterProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/FilterCollectionExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/FilterCollectionExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/FilterCollectionExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/FilterCollectionExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/FlushReportingStream.cs b/test/Microsoft.AspNet.Mvc.Core.Test/FlushReportingStream.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/FlushReportingStream.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/FlushReportingStream.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Internal/TypeHelperTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Internal/TypeHelperTest.cs deleted file mode 100644 index 7fe17934b8..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Internal/TypeHelperTest.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Xunit; - -namespace Microsoft.AspNet.Mvc.Internal -{ - public class TypeHelperTest - { - public static TheoryData> IgnoreCaseTestData - { - get - { - return new TheoryData> - { - { - new - { - selected = true, - SeLeCtEd = false - }, - new KeyValuePair("selected", false) - }, - { - new - { - SeLeCtEd = false, - selected = true - }, - new KeyValuePair("SeLeCtEd", true) - }, - { - new - { - SelECTeD = false, - SeLECTED = true - }, - new KeyValuePair("SelECTeD", true) - } - }; - } - } - - [Theory] - [MemberData(nameof(IgnoreCaseTestData))] - public void ObjectToDictionary_IgnoresPropertyCase(object testObject, - KeyValuePair expectedEntry) - { - // Act - var result = TypeHelper.ObjectToDictionary(testObject); - - // Assert - var entry = Assert.Single(result); - Assert.Equal(expectedEntry, entry); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ModelBindingHelperTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBindingHelperTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ModelBindingHelperTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBindingHelperTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/MvcOptionsTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/MvcOptionsTests.cs index 2f16b41573..6cc4971c9b 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/MvcOptionsTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/MvcOptionsTests.cs @@ -8,18 +8,6 @@ namespace Microsoft.AspNet.Mvc.Core.Test { public class MvcOptionsTests { - [Fact] - public void AntiForgeryOptions_SettingNullValue_Throws() - { - // Arrange - var options = new MvcOptions(); - - // Act & Assert - var ex = Assert.Throws(() => options.AntiForgeryOptions = null); - Assert.Equal("The 'AntiForgeryOptions' property of 'Microsoft.AspNet.Mvc.MvcOptions' must not be null." + - Environment.NewLine + "Parameter name: value", ex.Message); - } - [Fact] public void MaxValidationError_ThrowsIfValueIsOutOfRange() { @@ -30,18 +18,5 @@ namespace Microsoft.AspNet.Mvc.Core.Test var ex = Assert.Throws(() => options.MaxModelValidationErrors = -1); Assert.Equal("value", ex.ParamName); } - - [Fact] - public void ThrowsWhenMultipleCacheProfilesWithSameNameAreAdded() - { - // Arrange - var options = new MvcOptions(); - options.CacheProfiles.Add("HelloWorld", new CacheProfile { Duration = 10 }); - - // Act & Assert - var ex = Assert.Throws( - () => options.CacheProfiles.Add("HelloWorld", new CacheProfile { Duration = 5 })); - Assert.Equal("An item with the same key has already been added.", ex.Message); - } } } \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/MvcRouteHandlerTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/MvcRouteHandlerTests.cs index 5a3e99bb90..e56f822ca8 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/MvcRouteHandlerTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/MvcRouteHandlerTests.cs @@ -224,11 +224,7 @@ namespace Microsoft.AspNet.Mvc if (optionsAccessor == null) { - var options = new Mock>(); - options.SetupGet(o => o.Options) - .Returns(new MvcOptions()); - - optionsAccessor = options.Object; + optionsAccessor = new MockMvcOptionsAccessor(); } var notifier = new Notifier(new NotifierMethodAdapter()); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/NoContentFormatterTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/NoContentFormatterTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/NoContentFormatterTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/NoContentFormatterTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/NonDisposableStreamTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/NonDisposableStreamTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/NonDisposableStreamTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/NonDisposableStreamTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ObjectResultTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ObjectResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ObjectResultTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ObjectResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/OutputFormatterTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/OutputFormatterTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/OutputFormatterTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/OutputFormatterTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/StreamOutputFormatterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/StreamOutputFormatterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/StreamOutputFormatterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/StreamOutputFormatterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/StringOutputFormatterTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/StringOutputFormatterTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/StringOutputFormatterTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/StringOutputFormatterTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/TypeHelperTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/TypeHelperTest.cs deleted file mode 100644 index 369d34cf56..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/TypeHelperTest.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Xunit; - -namespace Microsoft.AspNet.Mvc -{ - public class TypeHelperTest - { - [Fact] - public void ObjectToDictionary_WithNullObject_ReturnsEmptyDictionary() - { - // Arrange - object value = null; - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(0, dictValues.Count); - } - - [Fact] - public void ObjectToDictionary_WithPlainObjectType_ReturnsEmptyDictionary() - { - // Arrange - var value = new object(); - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(0, dictValues.Count); - } - - [Fact] - public void ObjectToDictionary_WithPrimitiveType_LooksUpPublicProperties() - { - // Arrange - var value = "test"; - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(1, dictValues.Count); - Assert.Equal(4, dictValues["Length"]); - } - - [Fact] - public void ObjectToDictionary_WithAnonymousType_LooksUpProperties() - { - // Arrange - var value = new { test = "value", other = 1 }; - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(2, dictValues.Count); - Assert.Equal("value", dictValues["test"]); - Assert.Equal(1, dictValues["other"]); - } - - [Fact] - public void ObjectToDictionary_ReturnsCaseInsensitiveDictionary() - { - // Arrange - var value = new { TEST = "value", oThEr = 1 }; - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(2, dictValues.Count); - Assert.Equal("value", dictValues["test"]); - Assert.Equal(1, dictValues["other"]); - } - - [Fact] - public void ObjectToDictionary_ReturnsInheritedProperties() - { - // Arrange - var value = new ThreeDPoint() { X = 5, Y = 10, Z = 17 }; - - // Act - var dictValues = TypeHelper.ObjectToDictionary(value); - - // Assert - Assert.NotNull(dictValues); - Assert.Equal(3, dictValues.Count); - Assert.Equal(5, dictValues["X"]); - Assert.Equal(10, dictValues["Y"]); - Assert.Equal(17, dictValues["Z"]); - } - - private class Point - { - public int X { get; set; } - public int Y { get; set; } - } - - private class ThreeDPoint : Point - { - public int Z { get; set; } - } - } -} diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Utils/ValidationAttributeUtil.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Utils/ValidationAttributeUtil.cs deleted file mode 100644 index 5ee0369b4e..0000000000 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Utils/ValidationAttributeUtil.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.DataAnnotations; - -namespace Microsoft.AspNet.Mvc -{ - public static class ValidationAttributeUtil - { - public static string GetMinLengthErrorMessage(int length, string field) - { - var attr = new MinLengthAttribute(length); - return attr.FormatErrorMessage(field); - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ActionFilterAttributeTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ActionFilterAttributeTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryOptionsTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryOptionsTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryOptionsTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryOptionsTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenSerializerTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenSerializerTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenSerializerTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenSerializerTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenStoreTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenStoreTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenStoreTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenStoreTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryTokenTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryTokenTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryWorkerTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryWorkerTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/AntiForgeryWorkerTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/AntiForgeryWorkerTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/BinaryBlobTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/BinaryBlobTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/BinaryBlobTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/BinaryBlobTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/ClaimUidExtractorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/ClaimUidExtractorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/ClaimUidExtractorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/ClaimUidExtractorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/IAntiForgeryTokenProvider.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/IAntiForgeryTokenProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/IAntiForgeryTokenProvider.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/IAntiForgeryTokenProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/TokenProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/TokenProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/TokenProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/TokenProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs similarity index 95% rename from test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs index 4bea3254ed..e6295bb812 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/AntiXsrf/ValidateAntiForgeryTokenAttributeTest.cs @@ -34,12 +34,12 @@ namespace Microsoft.AspNet.Mvc.Core.Test var claimExtractor = new Mock(); var dataProtectionProvider = new Mock(); var additionalDataProvider = new Mock(); - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); var mockDataProtectionOptions = new Mock>(); mockDataProtectionOptions .SetupGet(options => options.Options) .Returns(Mock.Of()); - optionsAccessor.SetupGet(o => o.Options).Returns(new MvcOptions()); + optionsAccessor.SetupGet(o => o.Options).Returns(new AntiForgeryOptions()); return new AntiForgery(claimExtractor.Object, dataProtectionProvider.Object, additionalDataProvider.Object, diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/Authorization/AuthorizationApplicationModelProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Authorization/AuthorizationApplicationModelProviderTest.cs new file mode 100644 index 0000000000..1b457f9d91 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Authorization/AuthorizationApplicationModelProviderTest.cs @@ -0,0 +1,87 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNet.Authorization; +using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Mvc.Filters; +using Microsoft.AspNet.Mvc.ModelBinding; +using Microsoft.Framework.Internal; +using Microsoft.Framework.OptionsModel; +using Xunit; + +namespace Microsoft.AspNet.Mvc.ApplicationModels +{ + public class AuthorizationApplicationModelProviderTest + { + [Fact] + public void CreateControllerModel_AuthorizeAttributeAddsAuthorizeFilter() + { + // Arrange + var provider = new AuthorizationApplicationModelProvider(new MockAuthorizationOptionsAccessor()); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new[] { typeof(AccountController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + provider.OnProvidersExecuting(context); + + // Assert + var controller = Assert.Single(context.Result.Controllers); + Assert.Single(controller.Filters, f => f is AuthorizeFilter); + } + + [Fact] + public void BuildActionModels_BaseAuthorizeFiltersAreStillValidWhenOverriden() + { + // Arrange + var options = new MockAuthorizationOptionsAccessor(); + options.Options.AddPolicy("Base", policy => policy.RequireClaim("Basic").RequireClaim("Basic2")); + options.Options.AddPolicy("Derived", policy => policy.RequireClaim("Derived")); + + var provider = new AuthorizationApplicationModelProvider(options); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new[] { typeof(DerivedController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + provider.OnProvidersExecuting(context); + + // Assert + var controller = Assert.Single(context.Result.Controllers); + var action = Assert.Single(controller.Actions); + Assert.Equal("Authorize", action.ActionName); + Assert.Null(action.AttributeRouteModel); + var authorizeFilters = action.Filters.OfType(); + Assert.Single(authorizeFilters); + Assert.Equal(3, authorizeFilters.First().Policy.Requirements.Count); + } + + private class BaseController + { + [Authorize(Policy = "Base")] + public virtual void Authorize() + { + } + } + + private class DerivedController : BaseController + { + [Authorize(Policy = "Derived")] + public override void Authorize() + { + } + } + + [Authorize] + public class AccountController + { + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/AuthorizeFilterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Authorization/AuthorizeFilterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/AuthorizeFilterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Authorization/AuthorizeFilterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/BadRequestObjectResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/BadRequestObjectResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/BadRequestObjectResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/BadRequestObjectResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/BadRequestResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/BadRequestResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/BadRequestResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/BadRequestResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ChallengeResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ChallengeResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ChallengeResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ChallengeResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ConsumesAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ConsumesAttributeTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ConsumesAttributeTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ConsumesAttributeTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ContentResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ContentResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ContentResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ContentResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ControllerTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ControllerTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ControllerTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerUnitTestabilityTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ControllerUnitTestabilityTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ControllerUnitTestabilityTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ControllerUnitTestabilityTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/Cors/CorsApplicationModelProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Cors/CorsApplicationModelProviderTest.cs new file mode 100644 index 0000000000..bd3964fe6c --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Cors/CorsApplicationModelProviderTest.cs @@ -0,0 +1,121 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNet.Cors.Core; +using Microsoft.AspNet.Mvc.Filters; +using Microsoft.AspNet.Mvc.ModelBinding; +using Microsoft.Framework.Internal; +using Microsoft.Framework.OptionsModel; +using Xunit; + +namespace Microsoft.AspNet.Mvc.ApplicationModels +{ + public class CorsApplicationModelProviderTest + { + + [Fact] + public void CreateControllerModel_EnableCorsAttributeAddsCorsAuthorizationFilterFactory() + { + // Arrange + var corsProvider = new CorsApplicationModelProvider(); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new [] { typeof(CorsController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + corsProvider.OnProvidersExecuting(context); + + // Assert + var model = Assert.Single(context.Result.Controllers); + Assert.Single(model.Filters, f => f is CorsAuthorizationFilterFactory); + } + + [Fact] + public void CreateControllerModel_DisableCorsAttributeAddsDisableCorsAuthorizationFilter() + { + // Arrange + var corsProvider = new CorsApplicationModelProvider(); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new[] { typeof(DisableCorsController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + corsProvider.OnProvidersExecuting(context); + + // Assert + var model = Assert.Single(context.Result.Controllers); + Assert.Single(model.Filters, f => f is DisableCorsAuthorizationFilter); + } + + [Fact] + public void BuildActionModel_EnableCorsAttributeAddsCorsAuthorizationFilterFactory() + { + // Arrange + var corsProvider = new CorsApplicationModelProvider(); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new[] { typeof(EnableCorsController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + corsProvider.OnProvidersExecuting(context); + + // Assert + var controller = Assert.Single(context.Result.Controllers); + var action = Assert.Single(controller.Actions); + Assert.Single(action.Filters, f => f is CorsAuthorizationFilterFactory); + } + + [Fact] + public void BuildActionModel_DisableCorsAttributeAddsDisableCorsAuthorizationFilter() + { + // Arrange + var corsProvider = new CorsApplicationModelProvider(); + var defaultProvider = new DefaultApplicationModelProvider(new MockMvcOptionsAccessor()); + + var context = new ApplicationModelProviderContext(new[] { typeof(DisableCorsActionController).GetTypeInfo() }); + defaultProvider.OnProvidersExecuting(context); + + // Act + corsProvider.OnProvidersExecuting(context); + + // Assert + var controller = Assert.Single(context.Result.Controllers); + var action = Assert.Single(controller.Actions); + Assert.True(action.Filters.Any(f => f is DisableCorsAuthorizationFilter)); + } + + private class EnableCorsController + { + [EnableCors("policy")] + public void Action() + { + } + } + + private class DisableCorsActionController + { + [DisableCors] + public void Action() + { + } + } + + [EnableCors("policy")] + public class CorsController + { + } + + [DisableCors] + public class DisableCorsController + { + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/CorsAuthorizationFilterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Cors/CorsAuthorizationFilterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/CorsAuthorizationFilterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Cors/CorsAuthorizationFilterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedAtActionResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedAtActionResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedAtActionResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedAtActionResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedAtRouteResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedAtRouteResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedAtRouteResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedAtRouteResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/CreatedResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/CreatedResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/EmptyResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/EmptyResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/EmptyResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/EmptyResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileContentResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FileContentResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileContentResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FileContentResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FilePathResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FilePathResultTest.cs similarity index 99% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FilePathResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FilePathResultTest.cs index 19d2017b45..20b5cded96 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FilePathResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/FilePathResultTest.cs @@ -125,7 +125,7 @@ namespace Microsoft.AspNet.Mvc // Point the FileProviderRoot to a subfolder var result = new FilePathResult(path, MediaTypeHeaderValue.Parse(expectedContentType)) { - FileProvider = new PhysicalFileProvider(Path.GetFullPath("Utils")), + FileProvider = new PhysicalFileProvider(Path.GetFullPath("Properties")), }; var httpContext = new DefaultHttpContext(); @@ -156,7 +156,7 @@ namespace Microsoft.AspNet.Mvc // Point the FileProviderRoot to a subfolder var result = new FilePathResult(path, "text/plain") { - FileProvider = new PhysicalFileProvider(Path.GetFullPath("Utils")), + FileProvider = new PhysicalFileProvider(Path.GetFullPath("Properties")), }; var httpContext = new DefaultHttpContext(); @@ -185,7 +185,7 @@ namespace Microsoft.AspNet.Mvc // Point the FileProviderRoot to a subfolder var result = new FilePathResult(path, "text/plain") { - FileProvider = new PhysicalFileProvider(Path.GetFullPath("Utils")), + FileProvider = new PhysicalFileProvider(Path.GetFullPath("Properties")), }; var httpContext = new DefaultHttpContext(); @@ -334,7 +334,7 @@ namespace Microsoft.AspNet.Mvc // Arrange // Point the IFileProvider root to a different subfolder - var fileProvider = new PhysicalFileProvider(Path.GetFullPath("./Utils")); + var fileProvider = new PhysicalFileProvider(Path.GetFullPath("./Properties")); var filePathResult = new FilePathResult(path, "text/plain") { FileProvider = fileProvider, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FileResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FileResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileStreamResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FileStreamResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/FileStreamResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FileStreamResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/FormatFilterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FormatFilterTest.cs similarity index 94% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/FormatFilterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FormatFilterTest.cs index 7385844e6a..88b0e4b4ec 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/FormatFilterTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/FormatFilterTest.cs @@ -118,7 +118,7 @@ namespace Microsoft.AspNet.Mvc var resultExecutingContext = mockObjects.CreateResultExecutingContext(); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilter[] { }); - mockObjects.MockOptions.FormatterMappings.SetMediaTypeMappingForFormat( + mockObjects.MockFormatterMappingOptions.FormatterMappings.SetMediaTypeMappingForFormat( format, MediaTypeHeaderValue.Parse(contentType)); @@ -201,7 +201,7 @@ namespace Microsoft.AspNet.Mvc var mockObjects = new MockObjects("xml", FormatSource.RouteData); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilter[] { produces }); - mockObjects.MockOptions.FormatterMappings.SetMediaTypeMappingForFormat( + mockObjects.MockFormatterMappingOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml")); @@ -222,7 +222,7 @@ namespace Microsoft.AspNet.Mvc var mockObjects = new MockObjects("xml", FormatSource.RouteData); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilter[] { produces }); - mockObjects.MockOptions.FormatterMappings.SetMediaTypeMappingForFormat( + mockObjects.MockFormatterMappingOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml;version=1")); @@ -248,7 +248,7 @@ namespace Microsoft.AspNet.Mvc var mockObjects = new MockObjects(format, place); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilter[] { produces }); - mockObjects.MockOptions.FormatterMappings.SetMediaTypeMappingForFormat( + mockObjects.MockFormatterMappingOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml")); @@ -319,11 +319,12 @@ namespace Microsoft.AspNet.Mvc private class MockObjects { public MvcOptions MockOptions { get; private set; } + public MvcFormatterMappingOptions MockFormatterMappingOptions { get; private set; } public HttpContext MockHttpContext { get; private set; } public ActionContext MockActionContext { get; private set; } public IScopedInstance ScopedInstance { get; private set; } - public IOptions IOptions { get; private set; } + public IOptions IOptions { get; private set; } public MockObjects(string format = null, FormatSource? place = null) { @@ -384,6 +385,7 @@ namespace Microsoft.AspNet.Mvc { // Setup options on mock service provider MockOptions = new MvcOptions(); + MockFormatterMappingOptions = new MvcFormatterMappingOptions(); // Set up default output formatters. MockOptions.OutputFormatters.Add(new HttpNoContentOutputFormatter()); @@ -391,12 +393,12 @@ namespace Microsoft.AspNet.Mvc MockOptions.OutputFormatters.Add(new JsonOutputFormatter()); // Set up default mapping for json extensions to content type - MockOptions.FormatterMappings.SetMediaTypeMappingForFormat( + MockFormatterMappingOptions.FormatterMappings.SetMediaTypeMappingForFormat( "json", MediaTypeHeaderValue.Parse("application/json")); - var mvcOptions = new Mock>(); - mvcOptions.Setup(o => o.Options).Returns(MockOptions); + var mvcOptions = new Mock>(); + mvcOptions.Setup(o => o.Options).Returns(MockFormatterMappingOptions); IOptions = mvcOptions.Object; // Setup MVC services on mock service provider diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/FormatterMappingsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/FormatterMappingsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/FormatterMappingsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/FormatterMappingsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpNotFoundObjectResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/HttpNotFoundObjectResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpNotFoundObjectResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/HttpNotFoundObjectResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpNotFoundResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/HttpNotFoundResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpNotFoundResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/HttpNotFoundResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpStatusCodeResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/HttpStatusCodeResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpStatusCodeResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/HttpStatusCodeResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpUnauthorizedResultTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/HttpUnauthorizedResultTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/HttpUnauthorizedResultTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/HttpUnauthorizedResultTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonInputFormatterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/JsonInputFormatterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonInputFormatterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/JsonInputFormatterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonOutputFormatterTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/JsonOutputFormatterTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonOutputFormatterTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/JsonOutputFormatterTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonPatchInputFormatterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/JsonPatchInputFormatterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Formatters/JsonPatchInputFormatterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/JsonPatchInputFormatterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/JsonResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/JsonResultTest.cs similarity index 96% rename from test/Microsoft.AspNet.Mvc.Core.Test/JsonResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/JsonResultTest.cs index 597d24f292..a71dc5b18e 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/JsonResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/JsonResultTest.cs @@ -9,7 +9,6 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Internal; -using Microsoft.AspNet.Mvc.Xml; using Microsoft.AspNet.Routing; using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; @@ -36,7 +35,7 @@ namespace Microsoft.AspNet.Mvc var optionsFormatters = new List() { - new XmlDataContractSerializerOutputFormatter(), // This won't be used + Mock.Of(), // This won't be used new JsonOutputFormatter(), }; @@ -62,7 +61,7 @@ namespace Microsoft.AspNet.Mvc var optionsFormatters = new List() { - new XmlDataContractSerializerOutputFormatter(), // This won't be used + Mock.Of(), // This won't be used new JsonOutputFormatter(), }; @@ -88,7 +87,7 @@ namespace Microsoft.AspNet.Mvc var optionsFormatters = new List() { - new XmlDataContractSerializerOutputFormatter(), // This won't be used + Mock.Of(), // This won't be used new JsonOutputFormatter(), }; @@ -226,6 +225,8 @@ namespace Microsoft.AspNet.Mvc optionsAccessor.SetupGet(o => o.Options) .Returns(options); + services.Setup(s => s.GetService(typeof(IOptions))) + .Returns(optionsAccessor.Object); services.Setup(s => s.GetService(typeof(IOptions))) .Returns(optionsAccessor.Object); services.Setup(s => s.GetService(typeof(ILogger))) diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/Microsoft.AspNet.Mvc.Extensions.Test.xproj b/test/Microsoft.AspNet.Mvc.Extensions.Test/Microsoft.AspNet.Mvc.Extensions.Test.xproj new file mode 100644 index 0000000000..5e257fd31f --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Microsoft.AspNet.Mvc.Extensions.Test.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 5df6efa5-865e-450b-bf83-de9ce88eb77c + Microsoft.AspNet.Mvc.Extensions.Test + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/MockAuthorizationOptionsAccessor.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/MockAuthorizationOptionsAccessor.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/MockAuthorizationOptionsAccessor.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/MockAuthorizationOptionsAccessor.cs diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcOptionsAccessor.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcOptionsAccessor.cs new file mode 100644 index 0000000000..7242656e6e --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcOptionsAccessor.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Mvc +{ + public class MockMvcOptionsAccessor : IOptions + { + public MockMvcOptionsAccessor() + { + Options = new MvcOptions(); + } + + public MvcOptions Options { get; private set; } + + public MvcOptions GetNamedOptions(string name) + { + return Options; + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcViewOptionsAccessor.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcViewOptionsAccessor.cs new file mode 100644 index 0000000000..9f3356d08f --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/MockMvcViewOptionsAccessor.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Framework.OptionsModel; + +namespace Microsoft.AspNet.Mvc +{ + public class MockMvcViewOptionsAccessor : IOptions + { + public MockMvcViewOptionsAccessor() + { + Options = new MvcViewOptions(); + } + + public MvcViewOptions Options { get; private set; } + + public MvcViewOptions GetNamedOptions(string name) + { + return Options; + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs similarity index 99% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs index e6152a0718..a9f6e83d94 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs @@ -162,7 +162,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata Name = nameof(Test.Resources.DisplayAttribute_Name), ResourceType = typeof(Test.Resources), #else - Name = nameof(Core.Test.Resources.DisplayAttribute_Name), + Name = nameof(Extensions.Test.Resources.DisplayAttribute_Name), ResourceType = typeof(TestResources), #endif }; @@ -191,7 +191,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata Description = nameof(Test.Resources.DisplayAttribute_Description), ResourceType = typeof(Test.Resources), #else - Description = nameof(Core.Test.Resources.DisplayAttribute_Description), + Description = nameof(Extensions.Test.Resources.DisplayAttribute_Description), ResourceType = typeof(TestResources), #endif }; diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/TestModelNameProvider.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/TestModelNameProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/TestModelNameProvider.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Metadata/TestModelNameProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/TestResources.cs similarity index 95% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/TestResources.cs index 5ded5a2057..f9ecd81456 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/TestResources.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading; -using Microsoft.AspNet.Mvc.Core.Test; +using Microsoft.AspNet.Mvc.Extensions.Test; namespace Microsoft.AspNet.Mvc.ModelBinding { diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs index b33658112a..c96e5e94a5 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation var attribute = new CompareAttribute("OtherProperty") { ErrorMessageResourceName = "CompareAttributeTestResource", - ErrorMessageResourceType = typeof(Core.Test.Resources), + ErrorMessageResourceType = typeof(Extensions.Test.Resources), }; var serviceCollection = new ServiceCollection(); var requestServices = serviceCollection.BuildServiceProvider(); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/MvcCacheOptionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/MvcCacheOptionsTest.cs new file mode 100644 index 0000000000..ef95a7d237 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/MvcCacheOptionsTest.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Xunit; + +namespace Microsoft.AspNet.Mvc +{ + public class MvcCacheOptionsTest + { + [Fact] + public void ThrowsWhenMultipleCacheProfilesWithSameNameAreAdded() + { + // Arrange + var options = new MvcCacheOptions(); + options.CacheProfiles.Add("HelloWorld", new CacheProfile { Duration = 10 }); + + // Act & Assert + var ex = Assert.Throws( + () => options.CacheProfiles.Add("HelloWorld", new CacheProfile { Duration = 5 })); + Assert.Equal("An item with the same key has already been added.", ex.Message); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/PartialViewResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/PartialViewResultTest.cs similarity index 96% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/PartialViewResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/PartialViewResultTest.cs index 54a51f0717..e2cd1fcbb9 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/PartialViewResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/PartialViewResultTest.cs @@ -168,11 +168,11 @@ namespace Microsoft.AspNet.Mvc .Returns(viewEngine.Object); serviceProvider.Setup(p => p.GetService(typeof(ILogger))) .Returns(new Mock>().Object); - serviceProvider.Setup(s => s.GetService(typeof(IOptions))) + serviceProvider.Setup(s => s.GetService(typeof(IOptions))) .Returns(() => { - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); optionsAccessor.SetupGet(o => o.Options) - .Returns(new MvcOptions()); + .Returns(new MvcViewOptions()); return optionsAccessor.Object; }); context.HttpContext.RequestServices = serviceProvider.Object; @@ -195,11 +195,11 @@ namespace Microsoft.AspNet.Mvc serviceProvider.Setup(s => s.GetService(typeof(ILogger))) .Returns(new Mock>().Object); - serviceProvider.Setup(s => s.GetService(typeof(IOptions))) + serviceProvider.Setup(s => s.GetService(typeof(IOptions))) .Returns(() => { - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); optionsAccessor.SetupGet(o => o.Options) - .Returns(new MvcOptions()); + .Returns(new MvcViewOptions()); return optionsAccessor.Object; }); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ProducesAttributeTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ProducesAttributeTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/AssemblyInfo.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..efe88e9865 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/Resources.Designer.cs similarity index 92% rename from test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/Resources.Designer.cs index 96fca5c213..a76e8b66b9 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Properties/Resources.Designer.cs @@ -1,5 +1,5 @@ // -namespace Microsoft.AspNet.Mvc.Core.Test +namespace Microsoft.AspNet.Mvc.Extensions.Test { using System.Globalization; using System.Reflection; @@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test internal static class Resources { private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.AspNet.Mvc.Core.Test.Resources", typeof(Resources).GetTypeInfo().Assembly); + = new ResourceManager("Microsoft.AspNet.Mvc.Extensions.Test.Resources", typeof(Resources).GetTypeInfo().Assembly); /// /// Comparing {0} to {1}. diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectToActionResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectToActionResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectToActionResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectToActionResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectToRouteResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectToRouteResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/RedirectToRouteResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/RedirectToRouteResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/RemoteAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/RemoteAttributeTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/RemoteAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/RemoteAttributeTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultDisplayTemplatesTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultDisplayTemplatesTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultDisplayTemplatesTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultDisplayTemplatesTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultEditorTemplatesTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultEditorTemplatesTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultEditorTemplatesTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultEditorTemplatesTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultHtmlGeneratorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultHtmlGeneratorTest.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultHtmlGeneratorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultHtmlGeneratorTest.cs index bb7a0d1a95..2774ea21ac 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultHtmlGeneratorTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultHtmlGeneratorTest.cs @@ -572,8 +572,10 @@ namespace Microsoft.AspNet.Mvc.Rendering // GetCurrentValues uses only the IModelMetadataProvider passed to the DefaultHtmlGenerator constructor. private static IHtmlGenerator GetGenerator(IModelMetadataProvider metadataProvider) { - var mvcOptionsAccessor = new Mock>(); - mvcOptionsAccessor.SetupGet(accessor => accessor.Options).Returns(new MvcOptions()); + var antiforgeryOptionsAccessor = new Mock>(); + antiforgeryOptionsAccessor.SetupGet(accessor => accessor.Options).Returns(new AntiForgeryOptions()); + var mvcViewOptionsAccessor = new Mock>(); + mvcViewOptionsAccessor.SetupGet(accessor => accessor.Options).Returns(new MvcViewOptions()); var htmlEncoder = Mock.Of(); var dataOptionsAccessor = new Mock>(); dataOptionsAccessor.SetupGet(accessor => accessor.Options).Returns(new DataProtectionOptions()); @@ -581,7 +583,7 @@ namespace Microsoft.AspNet.Mvc.Rendering Mock.Of(), Mock.Of(), Mock.Of(), - mvcOptionsAccessor.Object, + antiforgeryOptionsAccessor.Object, htmlEncoder, dataOptionsAccessor.Object); @@ -592,7 +594,7 @@ namespace Microsoft.AspNet.Mvc.Rendering return new DefaultHtmlGenerator( antiForgery, - optionsAccessor.Object, + mvcViewOptionsAccessor.Object, metadataProvider, Mock.Of(), htmlEncoder); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultTemplatesUtilities.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultTemplatesUtilities.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultTemplatesUtilities.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultTemplatesUtilities.cs index 2e52f62b2c..abefe9b8d5 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/DefaultTemplatesUtilities.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/DefaultTemplatesUtilities.cs @@ -210,13 +210,13 @@ namespace Microsoft.AspNet.Mvc.Rendering var httpContext = new DefaultHttpContext(); var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor()); - var options = new MvcOptions(); + var options = new MvcViewOptions(); if (!string.IsNullOrEmpty(idAttributeDotReplacement)) { options.HtmlHelperOptions.IdAttributeDotReplacement = idAttributeDotReplacement; } options.ClientModelValidatorProviders.Add(new DataAnnotationsClientModelValidatorProvider()); - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); optionsAccessor .SetupGet(o => o.Options) .Returns(options); @@ -312,12 +312,12 @@ namespace Microsoft.AspNet.Mvc.Rendering var claimExtractor = new Mock(); var dataProtectionProvider = new Mock(); var additionalDataProvider = new Mock(); - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); var mockDataProtectionOptions = new Mock>(); mockDataProtectionOptions .SetupGet(options => options.Options) .Returns(Mock.Of()); - optionsAccessor.SetupGet(o => o.Options).Returns(new MvcOptions()); + optionsAccessor.SetupGet(o => o.Options).Returns(new AntiForgeryOptions()); return new AntiForgery( claimExtractor.Object, dataProtectionProvider.Object, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/Expression/ExpressionMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/Expression/ExpressionMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/Expression/ExpressionMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/Expression/ExpressionMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlAttributePropertyHelperTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlAttributePropertyHelperTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlAttributePropertyHelperTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlAttributePropertyHelperTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperCheckboxTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperCheckboxTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperCheckboxTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperCheckboxTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperDisplayNameExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperDisplayTextTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperDisplayTextTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperDisplayTextTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperDisplayTextTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperFormExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperFormExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperFormExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperFormExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperFormTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperFormTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperFormTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperFormTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperHiddenTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperHiddenTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperHiddenTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperHiddenTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperLabelExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperLabelExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperLabelExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperLabelExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperLinkGenerationTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperLinkGenerationTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperLinkGenerationTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperLinkGenerationTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperNameExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperNameExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperNameExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperNameExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperPartialExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperPartialExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperPartialExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperPartialExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperPasswordTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperPasswordTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperPasswordTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperPasswordTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperSelectTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperSelectTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperSelectTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperSelectTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperValidationSummaryTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperValidationSummaryTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperValidationSummaryTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperValidationSummaryTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperValueExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperValueExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/HtmlHelperValueExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/HtmlHelperValueExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/StringCollectionTextWriterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/StringCollectionTextWriterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/StringCollectionTextWriterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/StringCollectionTextWriterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TagBuilderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TagBuilderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TagBuilderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TagBuilderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TemplateRendererTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TemplateRendererTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TemplateRendererTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TemplateRendererTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TestResources.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TestResources.cs similarity index 91% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TestResources.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TestResources.cs index 0f226e4448..9243302c95 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/TestResources.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/TestResources.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNet.Mvc.Core.Test; +using Microsoft.AspNet.Mvc.Extensions.Test; namespace Microsoft.AspNet.Mvc { diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewContextTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewContextTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewContextTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewContextTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewDataOfTTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewDataOfTTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewDataOfTTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewDataOfTTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs similarity index 94% rename from test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs index 25d44ba9bb..552ffa27bd 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/Rendering/ViewEngine/CompositeViewEngineTest.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Mvc.Rendering serviceProvider.Setup(p => p.GetService(typeof(ITestService))) .Returns(service); var typeActivatorCache = new DefaultTypeActivatorCache(); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(viewEngine); optionsAccessor.Options.ViewEngines.Add(type); var compositeViewEngine = new CompositeViewEngine( @@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Mvc.Rendering // Arrange var viewName = "test-view"; var actionContext = GetActionContext(); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, Mock.Of(), @@ -73,7 +73,7 @@ namespace Microsoft.AspNet.Mvc.Rendering var engine = new Mock(); engine.Setup(e => e.FindView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.NotFound(viewName, new[] { "controller/test-view" })); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine.Object); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, @@ -97,7 +97,7 @@ namespace Microsoft.AspNet.Mvc.Rendering var view = Mock.Of(); engine.Setup(e => e.FindView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.Found(viewName, view)); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine.Object); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, @@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Mvc.Rendering engine3.Setup(e => e.FindView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.Found(viewName, view3)); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine1.Object); optionsAccessor.Options.ViewEngines.Add(engine2.Object); optionsAccessor.Options.ViewEngines.Add(engine3.Object); @@ -162,7 +162,7 @@ namespace Microsoft.AspNet.Mvc.Rendering engine3.Setup(e => e.FindView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.NotFound(viewName, new[] { "4", "5" })); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine1.Object); optionsAccessor.Options.ViewEngines.Add(engine2.Object); optionsAccessor.Options.ViewEngines.Add(engine3.Object); @@ -184,7 +184,7 @@ namespace Microsoft.AspNet.Mvc.Rendering { // Arrange var viewName = "my-partial-view"; - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, Mock.Of(), @@ -206,7 +206,7 @@ namespace Microsoft.AspNet.Mvc.Rendering var engine = new Mock(); engine.Setup(e => e.FindPartialView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.NotFound(viewName, new[] { "Shared/partial-view" })); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine.Object); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, @@ -230,7 +230,7 @@ namespace Microsoft.AspNet.Mvc.Rendering var view = Mock.Of(); engine.Setup(e => e.FindPartialView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.Found(viewName, view)); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine.Object); var compositeViewEngine = new CompositeViewEngine( optionsAccessor, @@ -262,7 +262,7 @@ namespace Microsoft.AspNet.Mvc.Rendering engine3.Setup(e => e.FindPartialView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.Found(viewName, view3)); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine1.Object); optionsAccessor.Options.ViewEngines.Add(engine2.Object); optionsAccessor.Options.ViewEngines.Add(engine3.Object); @@ -295,7 +295,7 @@ namespace Microsoft.AspNet.Mvc.Rendering engine3.Setup(e => e.FindPartialView(It.IsAny(), It.IsAny())) .Returns(ViewEngineResult.NotFound(viewName, new[] { "4", "5" })); - var optionsAccessor = new MockMvcOptionsAccessor(); + var optionsAccessor = new MockMvcViewOptionsAccessor(); optionsAccessor.Options.ViewEngines.Add(engine1.Object); optionsAccessor.Options.ViewEngines.Add(engine2.Object); optionsAccessor.Options.ViewEngines.Add(engine3.Object); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/RequireHttpsAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/RequireHttpsAttributeTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/RequireHttpsAttributeTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/RequireHttpsAttributeTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx b/test/Microsoft.AspNet.Mvc.Extensions.Test/Resources.resx similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx rename to test/Microsoft.AspNet.Mvc.Extensions.Test/Resources.resx diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResponseCacheAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ResponseCacheAttributeTest.cs similarity index 97% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResponseCacheAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ResponseCacheAttributeTest.cs index 2353700bff..3c192b1924 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResponseCacheAttributeTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ResponseCacheAttributeTest.cs @@ -182,8 +182,8 @@ namespace Microsoft.AspNet.Mvc private IServiceProvider GetServiceProvider(Dictionary cacheProfiles) { var serviceProvider = new Mock(); - var optionsAccessor = new Mock>(); - var options = new MvcOptions(); + var optionsAccessor = new Mock>(); + var options = new MvcCacheOptions(); if (cacheProfiles != null) { foreach (var p in cacheProfiles) @@ -194,7 +194,7 @@ namespace Microsoft.AspNet.Mvc optionsAccessor.SetupGet(o => o.Options).Returns(options); serviceProvider - .Setup(s => s.GetService(typeof(IOptions))) + .Setup(s => s.GetService(typeof(IOptions))) .Returns(optionsAccessor.Object); return serviceProvider.Object; diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResponseCacheFilterTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ResponseCacheFilterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResponseCacheFilterTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ResponseCacheFilterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResultFilterAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ResultFilterAttributeTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/ResultFilterAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ResultFilterAttributeTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/SerializableErrorTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/SerializableErrorTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/SerializableErrorTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/SerializableErrorTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ServiceBasedControllerActivatorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ServiceBasedControllerActivatorTest.cs similarity index 97% rename from test/Microsoft.AspNet.Mvc.Core.Test/ServiceBasedControllerActivatorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ServiceBasedControllerActivatorTest.cs index f2820dd819..eda86766cd 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ServiceBasedControllerActivatorTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ServiceBasedControllerActivatorTest.cs @@ -59,6 +59,10 @@ namespace Microsoft.AspNet.Mvc Assert.Equal(expected, ex.Message); } + private class Controller + { + } + private class DIController : Controller { } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/SkipStatusCodePagesAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/SkipStatusCodePagesAttributeTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/Filters/SkipStatusCodePagesAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/SkipStatusCodePagesAttributeTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/FilePathResultTestFile.txt b/test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/FilePathResultTestFile.txt similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/FilePathResultTestFile.txt rename to test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/FilePathResultTestFile.txt diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/FilePathResultTestFile_ASCII.txt b/test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/FilePathResultTestFile_ASCII.txt similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/FilePathResultTestFile_ASCII.txt rename to test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/FilePathResultTestFile_ASCII.txt diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/SubFolder/SubFolderTestFile.txt b/test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/SubFolder/SubFolderTestFile.txt similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/TestFiles/SubFolder/SubFolderTestFile.txt rename to test/Microsoft.AspNet.Mvc.Extensions.Test/TestFiles/SubFolder/SubFolderTestFile.txt diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponentTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponentTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponentTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponentTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ContentViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ContentViewComponentResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ContentViewComponentResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ContentViewComponentResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentActivatorTests.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentActivatorTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentActivatorTests.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentActivatorTests.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentDescriptorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentSelectorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentSelectorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/DefaultViewComponentSelectorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/DefaultViewComponentSelectorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/JsonViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/JsonViewComponentResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/JsonViewComponentResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/JsonViewComponentResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ViewComponentConventionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ViewComponentConventionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ViewComponentConventionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ViewComponentConventionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ViewViewComponentResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ViewViewComponentResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewComponents/ViewViewComponentResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewComponents/ViewViewComponentResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewDataDictionaryOfTModelTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewDataDictionaryOfTModelTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewDataDictionaryOfTModelTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewDataDictionaryOfTModelTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewDataDictionaryTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewDataDictionaryTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewDataDictionaryTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewDataDictionaryTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewEngineDescriptorExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewEngineDescriptorExtensionsTest.cs similarity index 92% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewEngineDescriptorExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewEngineDescriptorExtensionsTest.cs index 9e01d3be11..f4563805a7 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ViewEngineDescriptorExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewEngineDescriptorExtensionsTest.cs @@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOf_ThrowsInvalidOperationExceptionIfMoreThanOnceInstance() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(new TestViewEngine()); viewEngines.Add(Mock.Of()); viewEngines.Add(new TestViewEngine()); @@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOf_ThrowsInvalidOperationExceptionIfNoInstance() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(Mock.Of()); viewEngines.Add(typeof(TestViewEngine)); @@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOf_ReturnsInstanceOfIInputFormatterIfOneExists() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(Mock.Of()); var testEngine = new TestViewEngine(); viewEngines.Add(testEngine); @@ -111,7 +111,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOfOrDefault_ThrowsInvalidOperationExceptionIfMoreThanOnceInstance() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(new TestViewEngine()); viewEngines.Add(Mock.Of()); viewEngines.Add(new TestViewEngine()); @@ -124,7 +124,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOfOrDefault_ReturnsNullIfNoInstance() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(Mock.Of()); viewEngines.Add(typeof(TestViewEngine)); @@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstanceOfOrDefault_ReturnsInstanceOfIInputFormatterIfOneExists() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(Mock.Of()); viewEngines.Add(typeof(TestViewEngine)); var testEngine = new TestViewEngine(); @@ -158,7 +158,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstancesOf_ReturnsEmptyCollectionIfNoneExist() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(Mock.Of()); viewEngines.Add(typeof(TestViewEngine)); @@ -173,7 +173,7 @@ namespace Microsoft.AspNet.Mvc public void InputviewEngines_InstancesOf_ReturnsNonEmptyCollectionIfSomeExist() { // Arrange - var viewEngines = new MvcOptions().ViewEngines; + var viewEngines = new MvcViewOptions().ViewEngines; viewEngines.Add(typeof(TestViewEngine)); var viewEngine1 = new TestViewEngine(); var viewEngine2 = Mock.Of(); diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ViewEngineDescriptorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewEngineDescriptorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ViewEngineDescriptorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewEngineDescriptorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewExecutorTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewExecutorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewExecutorTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewExecutorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewResultTest.cs b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewResultTest.cs similarity index 96% rename from test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewResultTest.cs rename to test/Microsoft.AspNet.Mvc.Extensions.Test/ViewResultTest.cs index a9bd283ef2..758070c95d 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/ViewResultTest.cs @@ -180,11 +180,11 @@ namespace Microsoft.AspNet.Mvc .Returns(viewEngine.Object); serviceProvider.Setup(p => p.GetService(typeof(ILogger))) .Returns(new Mock>().Object); - serviceProvider.Setup(s => s.GetService(typeof(IOptions))) + serviceProvider.Setup(s => s.GetService(typeof(IOptions))) .Returns(() => { - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); optionsAccessor.SetupGet(o => o.Options) - .Returns(new MvcOptions()); + .Returns(new MvcViewOptions()); return optionsAccessor.Object; }); context.HttpContext.RequestServices = serviceProvider.Object; @@ -207,11 +207,11 @@ namespace Microsoft.AspNet.Mvc serviceProvider.Setup(s => s.GetService(typeof(ILogger))) .Returns(new Mock>().Object); - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); optionsAccessor.SetupGet(o => o.Options) - .Returns(new MvcOptions()); + .Returns(new MvcViewOptions()); - serviceProvider.Setup(s => s.GetService(typeof(IOptions))) + serviceProvider.Setup(s => s.GetService(typeof(IOptions))) .Returns(optionsAccessor.Object); var httpContext = new DefaultHttpContext(); diff --git a/test/Microsoft.AspNet.Mvc.Extensions.Test/project.json b/test/Microsoft.AspNet.Mvc.Extensions.Test/project.json new file mode 100644 index 0000000000..eab5145214 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.Extensions.Test/project.json @@ -0,0 +1,22 @@ +{ + "compilationOptions": { + "warningsAsErrors": "true" + }, + "dependencies": { + "Microsoft.AspNet.Mvc": "6.0.0-*", + "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, + "Microsoft.AspNet.Mvc.Xml": "6.0.0-*", + "Microsoft.AspNet.Testing": "1.0.0-*", + "Microsoft.Framework.DependencyInjection": "1.0.0-*", + "Microsoft.Framework.Logging.Testing": "1.0.0-*", + "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*", + "Moq": "4.2.1312.1622", + "xunit.runner.aspnet": "2.0.0-aspnet-*" + }, + "commands": { + "test": "xunit.runner.aspnet" + }, + "frameworks": { + "dnx451": { } + } +} diff --git a/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs b/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs index 81a06e1468..28e08e9328 100644 --- a/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs +++ b/test/Microsoft.AspNet.Mvc.IntegrationTests/TestMvcOptions.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNet.Mvc.Internal; using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Mvc.IntegrationTests @@ -12,6 +13,7 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests { Options = new MvcOptions(); MvcOptionsSetup.ConfigureMvc(Options); + JsonMvcOptionsSetup.ConfigureMvc(Options, SerializerSettingsProvider.CreateSerializerSettings()); } public MvcOptions Options { get; } diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json index bc0a6e284c..a501b2d5e7 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json @@ -2,6 +2,7 @@ "resource": "TestFiles/**", "dependencies": { "Microsoft.AspNet.Mvc.Core": "6.0.0-*", + "Microsoft.AspNet.Mvc.Extensions": "6.0.0-*", "Microsoft.AspNet.Mvc.Razor.Host": "6.0.0-*", "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Testing": "1.0.0-*", diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/TestableHtmlGenerator.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/TestableHtmlGenerator.cs index f88a73f1c5..d00c5f7cae 100644 --- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/TestableHtmlGenerator.cs +++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/TestableHtmlGenerator.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers public TestableHtmlGenerator( IModelMetadataProvider metadataProvider, - IOptions options, + IOptions options, IUrlHelper urlHelper, IDictionary validationAttributes) : base(GetAntiForgery(), options, metadataProvider, urlHelper, new CommonTestEncoder()) @@ -90,27 +90,26 @@ namespace Microsoft.AspNet.Mvc.TagHelpers return ValidationAttributes; } - private static IOptions GetOptions() + private static IOptions GetOptions() { - var mockOptions = new Mock>(); + var mockOptions = new Mock>(); mockOptions .SetupGet(options => options.Options) - .Returns(new MvcOptions()); + .Returns(new MvcViewOptions()); return mockOptions.Object; } private static AntiForgery GetAntiForgery() { // AntiForgery must be passed to TestableHtmlGenerator constructor but will never be called. - var optionsAccessor = new Mock>(); + var optionsAccessor = new Mock>(); var mockDataProtectionOptions = new Mock>(); mockDataProtectionOptions .SetupGet(options => options.Options) .Returns(Mock.Of()); - optionsAccessor.SetupGet(o => o.Options).Returns(new MvcOptions()); optionsAccessor .SetupGet(o => o.Options) - .Returns(new MvcOptions()); + .Returns(new AntiForgeryOptions()); var antiForgery = new AntiForgery( Mock.Of(), Mock.Of(), diff --git a/test/Microsoft.AspNet.Mvc.Test/MvcOptionsSetupTest.cs b/test/Microsoft.AspNet.Mvc.Test/MvcOptionsSetupTest.cs index 20645dc032..7610687395 100644 --- a/test/Microsoft.AspNet.Mvc.Test/MvcOptionsSetupTest.cs +++ b/test/Microsoft.AspNet.Mvc.Test/MvcOptionsSetupTest.cs @@ -7,6 +7,7 @@ using System.Xml.Linq; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.AspNet.Mvc.Razor; +using Microsoft.Framework.OptionsModel; using Newtonsoft.Json.Linq; using Xunit; @@ -18,8 +19,8 @@ namespace Microsoft.AspNet.Mvc public void Setup_SetsUpViewEngines() { // Arrange - var mvcOptions = new MvcOptions(); - var setup = new MvcOptionsSetup(); + var mvcOptions = new MvcViewOptions(); + var setup = new MvcViewOptionsSetup(); // Act setup.Configure(mvcOptions); @@ -80,10 +81,13 @@ namespace Microsoft.AspNet.Mvc { // Arrange var mvcOptions = new MvcOptions(); - var setup = new MvcOptionsSetup(); + var setup1 = new MvcOptionsSetup(); + var setup2 = new JsonMvcOptionsSetup(new OptionsManager( + Enumerable.Empty>())); // Act - setup.Configure(mvcOptions); + setup1.Configure(mvcOptions); + setup2.Configure(mvcOptions); // Assert Assert.Equal(4, mvcOptions.OutputFormatters.Count); @@ -98,10 +102,13 @@ namespace Microsoft.AspNet.Mvc { // Arrange var mvcOptions = new MvcOptions(); - var setup = new MvcOptionsSetup(); + var setup1 = new MvcOptionsSetup(); + var setup2 = new JsonMvcOptionsSetup(new OptionsManager( + Enumerable.Empty>())); // Act - setup.Configure(mvcOptions); + setup1.Configure(mvcOptions); + setup2.Configure(mvcOptions); // Assert Assert.Equal(2, mvcOptions.InputFormatters.Count); @@ -129,8 +136,8 @@ namespace Microsoft.AspNet.Mvc public void Setup_SetsUpClientModelValidatorProviders() { // Arrange - var mvcOptions = new MvcOptions(); - var setup = new MvcOptionsSetup(); + var mvcOptions = new MvcViewOptions(); + var setup = new MvcViewOptionsSetup(); // Act setup.Configure(mvcOptions); @@ -213,8 +220,11 @@ namespace Microsoft.AspNet.Mvc public void Setup_JsonFormattersUseSerializerSettings() { // Arrange + var jsonOptionsAccessor = new OptionsManager( + Enumerable.Empty>()); + var mvcOptions = new MvcOptions(); - var setup = new MvcOptionsSetup(); + var setup = new JsonMvcOptionsSetup(jsonOptionsAccessor); // Act setup.Configure(mvcOptions); @@ -223,13 +233,13 @@ namespace Microsoft.AspNet.Mvc var jsonInputFormatters = mvcOptions.InputFormatters.OfType(); foreach (var jsonInputFormatter in jsonInputFormatters) { - Assert.Same(mvcOptions.SerializerSettings, jsonInputFormatter.SerializerSettings); + Assert.Same(jsonOptionsAccessor.Options.SerializerSettings, jsonInputFormatter.SerializerSettings); } var jsonOuputFormatters = mvcOptions.OutputFormatters.OfType(); foreach (var jsonOuputFormatter in jsonOuputFormatters) { - Assert.Same(mvcOptions.SerializerSettings, jsonOuputFormatter.SerializerSettings); + Assert.Same(jsonOptionsAccessor.Options.SerializerSettings, jsonOuputFormatter.SerializerSettings); } } } diff --git a/test/Microsoft.AspNet.Mvc.Test/MvcServiceCollectionExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Test/MvcServiceCollectionExtensionsTest.cs index 68b6ca879d..e3145f9442 100644 --- a/test/Microsoft.AspNet.Mvc.Test/MvcServiceCollectionExtensionsTest.cs +++ b/test/Microsoft.AspNet.Mvc.Test/MvcServiceCollectionExtensionsTest.cs @@ -103,7 +103,7 @@ namespace Microsoft.AspNet.Mvc // Assert foreach (var serviceType in multiRegistrationServiceTypes) { - AssertServiceCountEquals(services, serviceType, 2); + AssertServiceCountEquals(services, serviceType.Key, serviceType.Value); } } @@ -120,7 +120,7 @@ namespace Microsoft.AspNet.Mvc // Assert var singleRegistrationServiceTypes = services - .Where(serviceDescriptor => !multiRegistrationServiceTypes.Contains(serviceDescriptor.ServiceType)) + .Where(serviceDescriptor => !multiRegistrationServiceTypes.Keys.Contains(serviceDescriptor.ServiceType)) .Select(serviceDescriptor => serviceDescriptor.ServiceType); foreach (var singleRegistrationType in singleRegistrationServiceTypes) @@ -129,20 +129,23 @@ namespace Microsoft.AspNet.Mvc } } - private IEnumerable MutliRegistrationServiceTypes + private Dictionary MutliRegistrationServiceTypes { get { - return new[] + return new Dictionary() { - typeof(IConfigureOptions), - typeof(IConfigureOptions), - typeof(IActionConstraintProvider), - typeof(IActionDescriptorProvider), - typeof(IActionInvokerProvider), - typeof(IFilterProvider), - typeof(IApiDescriptionProvider), - typeof(IApplicationModelProvider), + { typeof(IConfigureOptions), 4 }, + { typeof(IConfigureOptions), 2 }, + { typeof(IConfigureOptions), 2 }, + { typeof(IConfigureOptions), 2 }, + { typeof(IActionConstraintProvider), 2 }, + { typeof(IActionDescriptorProvider), 2 }, + { typeof(IActionInvokerProvider), 2 }, + { typeof(IControllerPropertyActivator), 4 }, + { typeof(IFilterProvider), 2 }, + { typeof(IApiDescriptionProvider), 2 }, + { typeof(IApplicationModelProvider), 6 }, }; } } diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ValidationAttributeUtil.cs b/test/Microsoft.AspNet.Mvc.TestCommon/ValidationAttributeUtil.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ValidationAttributeUtil.cs rename to test/Microsoft.AspNet.Mvc.TestCommon/ValidationAttributeUtil.cs diff --git a/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs b/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs index 7e38e9a8e4..94435c1a2e 100644 --- a/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs +++ b/test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/ApiControllerActionDiscoveryTest.cs @@ -389,9 +389,7 @@ namespace System.Web.Http .SetupGet(o => o.Options) .Returns(new AuthorizationOptions()); - var modelProvider = new DefaultApplicationModelProvider( - optionsAccessor.Object, - authorizationOptionsAccessor.Object); + var modelProvider = new DefaultApplicationModelProvider(optionsAccessor.Object); var provider = new ControllerActionDescriptorProvider( controllerTypeProvider, diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/SerializableErrorWrapperTests.cs b/test/Microsoft.AspNet.Mvc.Xml.Test/SerializableErrorWrapperTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/SerializableErrorWrapperTests.cs rename to test/Microsoft.AspNet.Mvc.Xml.Test/SerializableErrorWrapperTests.cs diff --git a/test/WebSites/CompositeViewEngineWebSite/Startup.cs b/test/WebSites/CompositeViewEngineWebSite/Startup.cs index a5e5f96dfb..1d5ba04d61 100644 --- a/test/WebSites/CompositeViewEngineWebSite/Startup.cs +++ b/test/WebSites/CompositeViewEngineWebSite/Startup.cs @@ -14,7 +14,7 @@ namespace CompositeViewEngineWebSite { // Add a view engine as the first one in the list. services.AddMvc() - .ConfigureMvc(options => + .ConfigureMvcViews(options => { options.ViewEngines.Insert(0, typeof(TestViewEngine)); }); diff --git a/test/WebSites/FormatFilterWebSite/Startup.cs b/test/WebSites/FormatFilterWebSite/Startup.cs index 318b026fd7..bf03de53a5 100644 --- a/test/WebSites/FormatFilterWebSite/Startup.cs +++ b/test/WebSites/FormatFilterWebSite/Startup.cs @@ -16,14 +16,16 @@ namespace FormatFilterWebSite { // Add MVC services to the services container services.AddMvc(); - services.Configure(options => + services.ConfigureMvc(options => { var formatFilter = new FormatFilterAttribute(); options.Filters.Add(formatFilter); var customFormatter = new CustomFormatter("application/custom"); options.OutputFormatters.Add(customFormatter); - + }); + services.ConfigureMvcFormatterMappings(options => + { options.FormatterMappings.SetMediaTypeMappingForFormat( "custom", MediaTypeHeaderValue.Parse("application/custom")); diff --git a/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj b/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj index 228e08b1f9..8224dc98f2 100644 --- a/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj +++ b/test/WebSites/LocalizationWebSite/LocalizationWebSite.xproj @@ -4,7 +4,6 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - fcfe6024-2720-49b4-8257-9dbc6114f0f1 @@ -12,9 +11,9 @@ ..\..\..\artifacts\obj\$(MSBuildProjectName) ..\..\..\artifacts\bin\$(MSBuildProjectName)\ - 2.0 + 17721 - + \ No newline at end of file diff --git a/test/WebSites/RazorWebSite/Startup.cs b/test/WebSites/RazorWebSite/Startup.cs index 42df4057e2..cd417a9e6e 100644 --- a/test/WebSites/RazorWebSite/Startup.cs +++ b/test/WebSites/RazorWebSite/Startup.cs @@ -24,7 +24,7 @@ namespace RazorWebSite { options.ViewLocationExpanders.Add(new CustomPartialDirectoryViewLocationExpander()); }); - services.ConfigureMvc(options => + services.ConfigureMvcViews(options => { options.HtmlHelperOptions.ClientValidationEnabled = false; options.HtmlHelperOptions.Html5DateRenderingMode = Microsoft.AspNet.Mvc.Rendering.Html5DateRenderingMode.Rfc3339; diff --git a/test/WebSites/ResponseCacheWebSite/Startup.cs b/test/WebSites/ResponseCacheWebSite/Startup.cs index 981a6e0c1b..7a385924e8 100644 --- a/test/WebSites/ResponseCacheWebSite/Startup.cs +++ b/test/WebSites/ResponseCacheWebSite/Startup.cs @@ -13,7 +13,7 @@ namespace ResponseCacheWebSite public void ConfigureServices(IServiceCollection services) { services.AddMvc(); - services.Configure(options => + services.ConfigureMvcCaching(options => { options.CacheProfiles.Add( "PublicCache30Sec", new CacheProfile @@ -44,7 +44,10 @@ namespace ResponseCacheWebSite Location = ResponseCacheLocation.Any, VaryByHeader = "Accept" }); + }); + services.ConfigureMvc(options => + { options.Filters.Add(new ResponseCacheFilter(new CacheProfile { NoStore = true,