From ae3c17073b31c1639fc9c485d68210fd6c8fe978 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 6 Apr 2015 16:48:55 +1200 Subject: [PATCH] Move MVC dependencies from Umbraco.Core to Umbraco.Web note:MvcHandler.DisableMvcResponseHeader = true was removed from UmbracoApplicationBase.StartApplication. This was the only breaking change, it can be put back in at a higher level if necessary. --- src/Umbraco.Core/DictionaryExtensions.cs | 15 --------- src/Umbraco.Core/Umbraco.Core.csproj | 31 ------------------- src/Umbraco.Core/UmbracoApplicationBase.cs | 5 --- src/Umbraco.Core/UriExtensions.cs | 3 -- src/Umbraco.Core/packages.config | 4 --- .../Mvc}/ProfilingView.cs | 4 +-- .../Mvc}/ProfilingViewEngine.cs | 4 +-- .../Mvc/QueryStringFilterAttribute.cs | 19 +++++++++++- .../Mvc}/UrlHelperExtensions.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 3 ++ 10 files changed, 26 insertions(+), 64 deletions(-) rename src/{Umbraco.Core/Profiling => Umbraco.Web/Mvc}/ProfilingView.cs (92%) rename src/{Umbraco.Core/Profiling => Umbraco.Web/Mvc}/ProfilingViewEngine.cs (95%) rename src/{Umbraco.Core => Umbraco.Web/Mvc}/UrlHelperExtensions.cs (96%) diff --git a/src/Umbraco.Core/DictionaryExtensions.cs b/src/Umbraco.Core/DictionaryExtensions.cs index ddfe963f48..c488650496 100644 --- a/src/Umbraco.Core/DictionaryExtensions.cs +++ b/src/Umbraco.Core/DictionaryExtensions.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; -using System.Web.Mvc; using System.Web; namespace Umbraco.Core @@ -135,20 +134,6 @@ namespace Umbraco.Core return n; } - /// - /// Converts a dictionary to a FormCollection - /// - /// - /// - public static FormCollection ToFormCollection(this IDictionary d) - { - var n = new FormCollection(); - foreach (var i in d) - { - n.Add(i.Key, Convert.ToString(i.Value)); - } - return n; - } /// /// Merges all key/values from the sources dictionaries into the destination dictionary diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index dec8a9c1fc..bacfeeef6b 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -54,10 +54,6 @@ False ..\packages\log4net-mediumtrust.2.0.0\lib\log4net.dll - - True - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - False ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll @@ -95,33 +91,9 @@ - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll - - - True - ..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll - - - True - ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll - False - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll - @@ -902,8 +874,6 @@ - - @@ -1210,7 +1180,6 @@ - diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index c861eca6cd..b2c66df7f4 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -1,9 +1,6 @@ using System; using System.Web; using System.Web.Hosting; -using System.Web.Mvc; -using StackExchange.Profiling; -using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.ObjectResolution; @@ -33,8 +30,6 @@ namespace Umbraco.Core /// internal void StartApplication(object sender, EventArgs e) { - //don't output the MVC version header (security) - MvcHandler.DisableMvcResponseHeader = true; //boot up the application GetBootManager() diff --git a/src/Umbraco.Core/UriExtensions.cs b/src/Umbraco.Core/UriExtensions.cs index 53441d7ea1..05c5da7450 100644 --- a/src/Umbraco.Core/UriExtensions.cs +++ b/src/Umbraco.Core/UriExtensions.cs @@ -1,9 +1,6 @@ using System; using System.IO; using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; using Umbraco.Core.Configuration; using Umbraco.Core.IO; diff --git a/src/Umbraco.Core/packages.config b/src/Umbraco.Core/packages.config index f01b9e68ba..5bce0f60d7 100644 --- a/src/Umbraco.Core/packages.config +++ b/src/Umbraco.Core/packages.config @@ -3,14 +3,10 @@ - - - - diff --git a/src/Umbraco.Core/Profiling/ProfilingView.cs b/src/Umbraco.Web/Mvc/ProfilingView.cs similarity index 92% rename from src/Umbraco.Core/Profiling/ProfilingView.cs rename to src/Umbraco.Web/Mvc/ProfilingView.cs index 354132df0f..59d85ba62c 100644 --- a/src/Umbraco.Core/Profiling/ProfilingView.cs +++ b/src/Umbraco.Web/Mvc/ProfilingView.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Web.Mvc; namespace Umbraco.Core.Profiling @@ -25,4 +25,4 @@ namespace Umbraco.Core.Profiling } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs b/src/Umbraco.Web/Mvc/ProfilingViewEngine.cs similarity index 95% rename from src/Umbraco.Core/Profiling/ProfilingViewEngine.cs rename to src/Umbraco.Web/Mvc/ProfilingViewEngine.cs index 70bb014bb3..7c5b7a2ce3 100644 --- a/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs +++ b/src/Umbraco.Web/Mvc/ProfilingViewEngine.cs @@ -1,4 +1,4 @@ -using System.Web.Mvc; +using System.Web.Mvc; namespace Umbraco.Core.Profiling { @@ -45,4 +45,4 @@ namespace Umbraco.Core.Profiling } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/Mvc/QueryStringFilterAttribute.cs b/src/Umbraco.Web/Mvc/QueryStringFilterAttribute.cs index 5e9399cf0d..db5ea4869d 100644 --- a/src/Umbraco.Web/Mvc/QueryStringFilterAttribute.cs +++ b/src/Umbraco.Web/Mvc/QueryStringFilterAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using Umbraco.Core; @@ -30,12 +31,28 @@ namespace Umbraco.Web.Mvc { var nonNullKeys = filterContext.HttpContext.Request.QueryString.AllKeys.Where(x => !string.IsNullOrEmpty(x)); var vals = nonNullKeys.ToDictionary(q => q, q => (object)filterContext.HttpContext.Request.QueryString[q]); - var qs = vals.ToFormCollection(); + var qs = ToFormCollection(vals); filterContext.ActionParameters[ParameterName] = qs; base.OnActionExecuting(filterContext); } + + /// + /// Converts a dictionary to a FormCollection + /// + /// + /// + public static FormCollection ToFormCollection(IDictionary d) + { + var n = new FormCollection(); + foreach (var i in d) + { + n.Add(i.Key, Convert.ToString(i.Value)); + } + return n; + } + } } diff --git a/src/Umbraco.Core/UrlHelperExtensions.cs b/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs similarity index 96% rename from src/Umbraco.Core/UrlHelperExtensions.cs rename to src/Umbraco.Web/Mvc/UrlHelperExtensions.cs index 4320bab5cc..543844ee08 100644 --- a/src/Umbraco.Core/UrlHelperExtensions.cs +++ b/src/Umbraco.Web/Mvc/UrlHelperExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 2d9077bdc8..076c2af1af 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -274,6 +274,9 @@ + + +