Removing 'Options' from ConfigureMvcOptions and ConfigureRazorViewEngineOptions.
This commit is contained in:
parent
c1338a0542
commit
d2bdd4f1d4
|
|
@ -58,13 +58,13 @@ namespace MvcSample.Web
|
||||||
services.AddSingleton<UserNameService>();
|
services.AddSingleton<UserNameService>();
|
||||||
services.AddTransient<ITestService, TestService>();
|
services.AddTransient<ITestService, TestService>();
|
||||||
|
|
||||||
services.ConfigureMvcOptions(options =>
|
services.ConfigureMvc(options =>
|
||||||
{
|
{
|
||||||
options.Filters.Add(typeof(PassThroughAttribute), order: 17);
|
options.Filters.Add(typeof(PassThroughAttribute), order: 17);
|
||||||
options.AddXmlDataContractSerializerFormatter();
|
options.AddXmlDataContractSerializerFormatter();
|
||||||
options.Filters.Add(new FormatFilterAttribute());
|
options.Filters.Add(new FormatFilterAttribute());
|
||||||
});
|
});
|
||||||
services.ConfigureRazorViewEngineOptions(options =>
|
services.ConfigureRazorViewEngine(options =>
|
||||||
{
|
{
|
||||||
var expander = new LanguageViewLocationExpander(
|
var expander = new LanguageViewLocationExpander(
|
||||||
context => context.HttpContext.Request.Query["language"]);
|
context => context.HttpContext.Request.Query["language"]);
|
||||||
|
|
@ -99,7 +99,7 @@ namespace MvcSample.Web
|
||||||
services.AddSingleton<UserNameService>();
|
services.AddSingleton<UserNameService>();
|
||||||
services.AddTransient<ITestService, TestService>();
|
services.AddTransient<ITestService, TestService>();
|
||||||
|
|
||||||
services.ConfigureMvcOptions(options =>
|
services.ConfigureMvc(options =>
|
||||||
{
|
{
|
||||||
options.Filters.Add(typeof(PassThroughAttribute), order: 17);
|
options.Filters.Add(typeof(PassThroughAttribute), order: 17);
|
||||||
options.AddXmlDataContractSerializerFormatter();
|
options.AddXmlDataContractSerializerFormatter();
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services">The services available in the application.</param>
|
/// <param name="services">The services available in the application.</param>
|
||||||
/// <param name="setupAction">An action to configure the <see cref="RazorViewEngineOptions"/>.</param>
|
/// <param name="setupAction">An action to configure the <see cref="RazorViewEngineOptions"/>.</param>
|
||||||
public static void ConfigureRazorViewEngineOptions(
|
public static void ConfigureRazorViewEngine(
|
||||||
[NotNull] this IServiceCollection services,
|
[NotNull] this IServiceCollection services,
|
||||||
[NotNull] Action<RazorViewEngineOptions> setupAction)
|
[NotNull] Action<RazorViewEngineOptions> setupAction)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@ namespace Microsoft.AspNet.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MvcOptionsSetup : ConfigureOptions<MvcOptions>
|
public class MvcOptionsSetup : ConfigureOptions<MvcOptions>
|
||||||
{
|
{
|
||||||
public MvcOptionsSetup() : base(ConfigureMvcOptions)
|
public MvcOptionsSetup() : base(ConfigureMvc)
|
||||||
{
|
{
|
||||||
Order = DefaultOrder.DefaultFrameworkSortOrder;
|
Order = DefaultOrder.DefaultFrameworkSortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public static void ConfigureMvcOptions(MvcOptions options)
|
public static void ConfigureMvc(MvcOptions options)
|
||||||
{
|
{
|
||||||
// Set up ViewEngines
|
// Set up ViewEngines
|
||||||
options.ViewEngines.Add(typeof(RazorViewEngine));
|
options.ViewEngines.Add(typeof(RazorViewEngine));
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services">The services available in the application.</param>
|
/// <param name="services">The services available in the application.</param>
|
||||||
/// <param name="setupAction">The <see cref="MvcOptions"/> which need to be configured.</param>
|
/// <param name="setupAction">The <see cref="MvcOptions"/> which need to be configured.</param>
|
||||||
public static void ConfigureMvcOptions(
|
public static void ConfigureMvc(
|
||||||
[NotNull] this IServiceCollection services,
|
[NotNull] this IServiceCollection services,
|
||||||
[NotNull] Action<MvcOptions> setupAction)
|
[NotNull] Action<MvcOptions> setupAction)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ConfigureMvcOptionsAddsOptionsProperly()
|
public async Task ConfigureMvc_AddsOptionsProperly()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var server = TestHelper.CreateServer(_app, SiteName);
|
var server = TestHelper.CreateServer(_app, SiteName);
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ConfigureRazorViewEngineOptions_ConfiguresOptionsProperly()
|
public void ConfigureRazorViewEngine_ConfiguresOptionsProperly()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var services = new ServiceCollection().AddOptions();
|
var services = new ServiceCollection().AddOptions();
|
||||||
var fileProvider = new TestFileProvider();
|
var fileProvider = new TestFileProvider();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
services.ConfigureRazorViewEngineOptions(options =>
|
services.ConfigureRazorViewEngine(options =>
|
||||||
{
|
{
|
||||||
options.FileProvider = fileProvider;
|
options.FileProvider = fileProvider;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace BasicWebSite
|
||||||
|
|
||||||
services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>();
|
services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>();
|
||||||
|
|
||||||
services.ConfigureMvcOptions(options =>
|
services.ConfigureMvc(options =>
|
||||||
{
|
{
|
||||||
options.Conventions.Add(new ApplicationDescription("This is a basic website."));
|
options.Conventions.Add(new ApplicationDescription("This is a basic website."));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue