Fix #3102 - Add an AddMvcOptions to builders
This makes it easier/possible for any third party code that extends IMvcBuilder to set options.
This commit is contained in:
parent
162e0b960d
commit
b95dcd5f1c
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
|
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,20 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class MvcCoreMvcBuilderExtensions
|
public static class MvcCoreMvcBuilderExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Registers an action to configure <see cref="MvcOptions"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IMvcBuilder"/>.</param>
|
||||||
|
/// <param name="setupAction">An <see cref="Action{MvcOptions}"/>.</param>
|
||||||
|
/// <returns>The <see cref="IMvcBuilder"/>.</returns>
|
||||||
|
public static IMvcBuilder AddMvcOptions(
|
||||||
|
[NotNull] this IMvcBuilder builder,
|
||||||
|
[NotNull] Action<MvcOptions> setupAction)
|
||||||
|
{
|
||||||
|
builder.Services.Configure<MvcOptions>(setupAction);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
public static IMvcBuilder AddFormatterMappings(
|
public static IMvcBuilder AddFormatterMappings(
|
||||||
[NotNull] this IMvcBuilder builder,
|
[NotNull] this IMvcBuilder builder,
|
||||||
[NotNull] Action<FormatterMappings> setupAction)
|
[NotNull] Action<FormatterMappings> setupAction)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,20 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
{
|
{
|
||||||
public static class MvcCoreMvcCoreBuilderExtensions
|
public static class MvcCoreMvcCoreBuilderExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Registers an action to configure <see cref="MvcOptions"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
|
||||||
|
/// <param name="setupAction">An <see cref="Action{MvcOptions}"/>.</param>
|
||||||
|
/// <returns>The <see cref="IMvcCoreBuilder"/>.</returns>
|
||||||
|
public static IMvcCoreBuilder AddMvcOptions(
|
||||||
|
[NotNull] this IMvcCoreBuilder builder,
|
||||||
|
[NotNull] Action<MvcOptions> setupAction)
|
||||||
|
{
|
||||||
|
builder.Services.Configure<MvcOptions>(setupAction);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
public static IMvcCoreBuilder AddFormatterMappings(this IMvcCoreBuilder builder)
|
public static IMvcCoreBuilder AddFormatterMappings(this IMvcCoreBuilder builder)
|
||||||
{
|
{
|
||||||
AddFormatterMappingsServices(builder.Services);
|
AddFormatterMappingsServices(builder.Services);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue