From b95dcd5f1ce17f18aee7b75640f5e80fbff2c4fa Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 21 Sep 2015 12:02:57 -0700 Subject: [PATCH] Fix #3102 - Add an AddMvcOptions to builders This makes it easier/possible for any third party code that extends IMvcBuilder to set options. --- NuGet.config | 2 +- .../MvcCoreMvcBuilderExtensions.cs | 14 ++++++++++++++ .../MvcCoreMvcCoreBuilderExtensions.cs | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 52bf414192..5500f6d507 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + diff --git a/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcBuilderExtensions.cs index 8355d80fdb..a0f9e56983 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcBuilderExtensions.cs @@ -16,6 +16,20 @@ namespace Microsoft.Framework.DependencyInjection /// public static class MvcCoreMvcBuilderExtensions { + /// + /// Registers an action to configure . + /// + /// The . + /// An . + /// The . + public static IMvcBuilder AddMvcOptions( + [NotNull] this IMvcBuilder builder, + [NotNull] Action setupAction) + { + builder.Services.Configure(setupAction); + return builder; + } + public static IMvcBuilder AddFormatterMappings( [NotNull] this IMvcBuilder builder, [NotNull] Action setupAction) diff --git a/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs index a45633ef0b..698216b1e6 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DependencyInjection/MvcCoreMvcCoreBuilderExtensions.cs @@ -16,6 +16,20 @@ namespace Microsoft.Framework.DependencyInjection { public static class MvcCoreMvcCoreBuilderExtensions { + /// + /// Registers an action to configure . + /// + /// The . + /// An . + /// The . + public static IMvcCoreBuilder AddMvcOptions( + [NotNull] this IMvcCoreBuilder builder, + [NotNull] Action setupAction) + { + builder.Services.Configure(setupAction); + return builder; + } + public static IMvcCoreBuilder AddFormatterMappings(this IMvcCoreBuilder builder) { AddFormatterMappingsServices(builder.Services);