diff --git a/Disco.BI/Disco.BI.csproj b/Disco.BI/Disco.BI.csproj index 7978bc58..95aef641 100644 --- a/Disco.BI/Disco.BI.csproj +++ b/Disco.BI/Disco.BI.csproj @@ -15,7 +15,6 @@ ..\ true - 2.2.16272.1003 true diff --git a/Disco.Client/Disco.Client.csproj b/Disco.Client/Disco.Client.csproj index a3a0ff23..61fccf1d 100644 --- a/Disco.Client/Disco.Client.csproj +++ b/Disco.Client/Disco.Client.csproj @@ -14,7 +14,6 @@ Client ..\ true - 2.2.16272.1003 AnyCPU diff --git a/Disco.ClientBootstrapper/Disco.ClientBootstrapper.csproj b/Disco.ClientBootstrapper/Disco.ClientBootstrapper.csproj index b9953299..8f6d5337 100644 --- a/Disco.ClientBootstrapper/Disco.ClientBootstrapper.csproj +++ b/Disco.ClientBootstrapper/Disco.ClientBootstrapper.csproj @@ -28,7 +28,6 @@ false false true - 2.2.16272.1003 x86 diff --git a/Disco.Data/Disco.Data.csproj b/Disco.Data/Disco.Data.csproj index 54b9c92f..22391aab 100644 --- a/Disco.Data/Disco.Data.csproj +++ b/Disco.Data/Disco.Data.csproj @@ -15,7 +15,6 @@ ..\ true - 2.2.16272.1003 true diff --git a/Disco.Models/Disco.Models.csproj b/Disco.Models/Disco.Models.csproj index 77629eba..c1d8b420 100644 --- a/Disco.Models/Disco.Models.csproj +++ b/Disco.Models/Disco.Models.csproj @@ -13,7 +13,6 @@ v4.5 512 - 2.2.16272.1003 true diff --git a/Disco.Services.Plugins.ManifestGenerator/Disco.Services.Plugins.ManifestGenerator.csproj b/Disco.Services.Plugins.ManifestGenerator/Disco.Services.Plugins.ManifestGenerator.csproj index 11470139..f7e8241e 100644 --- a/Disco.Services.Plugins.ManifestGenerator/Disco.Services.Plugins.ManifestGenerator.csproj +++ b/Disco.Services.Plugins.ManifestGenerator/Disco.Services.Plugins.ManifestGenerator.csproj @@ -12,7 +12,6 @@ v4.5.2 512 true - 2.0.16272.1003 AnyCPU diff --git a/Disco.Services/Disco.Services.csproj b/Disco.Services/Disco.Services.csproj index 2bf2dd76..40b3c644 100644 --- a/Disco.Services/Disco.Services.csproj +++ b/Disco.Services/Disco.Services.csproj @@ -15,7 +15,6 @@ ..\ true - 2.2.16272.1003 true diff --git a/Disco.Web.Extensions/Disco.Web.Extensions.csproj b/Disco.Web.Extensions/Disco.Web.Extensions.csproj index df3040cd..619bddc9 100644 --- a/Disco.Web.Extensions/Disco.Web.Extensions.csproj +++ b/Disco.Web.Extensions/Disco.Web.Extensions.csproj @@ -15,7 +15,6 @@ ..\ true - 2.2.16272.1003 true @@ -104,6 +103,7 @@ + diff --git a/Disco.Web.Extensions/MvcExtensions/JsonNet/JsonDotNetValueProviderFactory.cs b/Disco.Web.Extensions/MvcExtensions/JsonNet/JsonDotNetValueProviderFactory.cs new file mode 100644 index 00000000..4d36cb80 --- /dev/null +++ b/Disco.Web.Extensions/MvcExtensions/JsonNet/JsonDotNetValueProviderFactory.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Dynamic; +using System.Globalization; +using System.IO; +using System.Text; +using System.Web.Mvc; + +namespace Disco.Web.Extensions +{ + public class JsonDotNetValueProviderFactory : ValueProviderFactory + { + public override IValueProvider GetValueProvider(ControllerContext controllerContext) + { + if (controllerContext == null) + throw new ArgumentNullException(nameof(controllerContext)); + + if (!controllerContext.HttpContext.Request.ContentType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)) + return null; + + if (controllerContext.HttpContext.Request.InputStream.Length == 0) + return null; + + var jsonSerializer = new JsonSerializer(); + jsonSerializer.Converters.Add(new ExpandoObjectConverter()); + + using (var streamReader = new StreamReader(controllerContext.HttpContext.Request.InputStream, Encoding.UTF8, true, 0x400, true)) + { + using (var jsonReader = new JsonTextReader(streamReader)) + { + var bodyObject = jsonSerializer.Deserialize(jsonReader); + return new DictionaryValueProvider(bodyObject, CultureInfo.CurrentCulture); + } + } + } + } +} diff --git a/Disco.Web/App_Start/FilterConfig.cs b/Disco.Web/App_Start/FilterConfig.cs index 371cf47e..616bf74c 100644 --- a/Disco.Web/App_Start/FilterConfig.cs +++ b/Disco.Web/App_Start/FilterConfig.cs @@ -1,4 +1,5 @@ -using System.Web; +using Disco.Web.Extensions; +using System.Linq; using System.Web.Mvc; namespace Disco.Web @@ -7,7 +8,15 @@ namespace Disco.Web { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { - //filters.Add(new HandleErrorAttribute()); + // Remove Default Json Value Provider Factory (JavaScriptSerializer) + var defaultJsonValueProvider = ValueProviderFactories.Factories.OfType().FirstOrDefault(); + if (defaultJsonValueProvider != null) + { + ValueProviderFactories.Factories.Remove(defaultJsonValueProvider); + } + + // Add Custom Json Value Provider Factory (Json.Net) + ValueProviderFactories.Factories.Add(new JsonDotNetValueProviderFactory()); } } } \ No newline at end of file diff --git a/Disco.Web/Disco.Web.csproj b/Disco.Web/Disco.Web.csproj index e989324a..a03a2ec0 100644 --- a/Disco.Web/Disco.Web.csproj +++ b/Disco.Web/Disco.Web.csproj @@ -22,7 +22,6 @@ ..\ true - 2.2.16272.1003 diff --git a/Disco.Web/Global.asax.cs b/Disco.Web/Global.asax.cs index 68669700..d1b95f1d 100644 --- a/Disco.Web/Global.asax.cs +++ b/Disco.Web/Global.asax.cs @@ -24,19 +24,9 @@ namespace Disco.Web protected void Application_Start() { - var timer = new Stopwatch(); - long timer_last; - timer.Start(); - - - Debug.WriteLine("Application Startup Profiling Started"); - timer_last = timer.ElapsedMilliseconds; - if (AppConfig.InitializeDatabase()) { // Database Initialized - Debug.WriteLine("Initialized Database: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; using (DiscoDataContext database = new DiscoDataContext()) { @@ -64,33 +54,15 @@ namespace Disco.Web AreaRegistration.RegisterAllAreas(); - Debug.WriteLine("Registered Areas: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; - WebApiConfig.Register(GlobalConfiguration.Configuration); - Debug.WriteLine("Registered API: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; - FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); - Debug.WriteLine("Registered Global Filters: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; - RouteConfig.RegisterRoutes(RouteTable.Routes); - Debug.WriteLine("Registered Routes: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; - BundleConfig.RegisterBundles(); - Debug.WriteLine("Registered Bundles: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; - AppConfig.InitalizeNormalEnvironment(database); - - Debug.WriteLine("Initialized Environment: +{0}ms", timer.ElapsedMilliseconds - timer_last); - timer_last = timer.ElapsedMilliseconds; } else { @@ -107,6 +79,7 @@ namespace Disco.Web // Database Not Initialized // Install InitialConfig = true; + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterInstallRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(); } diff --git a/Disco.sln b/Disco.sln index 779ee4f4..73af35c9 100644 --- a/Disco.sln +++ b/Disco.sln @@ -129,10 +129,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(AutomaticVersions) = postSolution - PrimaryVersionType = AssemblyVersionAttribute - UpdateAssemblyVersion = False - UpdateAssemblyFileVersion = False - UpdateAssemblyInfoVersion = False - EndGlobalSection EndGlobal