[Fixes #2156] Remove IConfiguration from AddMvc

This commit is contained in:
Kiran Challa 2015-03-12 16:44:30 -07:00 committed by Kiran Challa
parent 9a44e3e08b
commit f06007d428
42 changed files with 41 additions and 47 deletions

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Routing;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;
@ -15,11 +14,6 @@ namespace Microsoft.Framework.DependencyInjection
{
public static class MvcServiceCollectionExtensions
{
public static IServiceCollection AddMvc([NotNull] this IServiceCollection services, IConfiguration config)
{
return services.AddMvc();
}
public static IServiceCollection AddMvc([NotNull] this IServiceCollection services)
{
ConfigureDefaultServices(services);

View File

@ -15,7 +15,7 @@ namespace ActionConstraintsWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{
options.AddXmlDataContractSerializerFormatter();

View File

@ -15,7 +15,7 @@ namespace ActionResultsWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{

View File

@ -16,7 +16,7 @@ namespace ActivatorWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.AddInstance(new MyService());
services.AddScoped<ViewService, ViewService>();
});

View File

@ -13,7 +13,7 @@ namespace AntiForgeryWebSite
var configuration = app.GetTestConfiguration();
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseErrorReporter();

View File

@ -16,7 +16,7 @@ namespace ApiExplorerWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddSingleton<ApiExplorerDataFilter>();
services.Configure<MvcOptions>(options =>

View File

@ -15,7 +15,7 @@ namespace ApplicationModelWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{

View File

@ -17,7 +17,7 @@ namespace AutofacWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddTransient<HelloWorldBuilder>();
var builder = new ContainerBuilder();

View File

@ -18,7 +18,7 @@ namespace BasicWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>();

View File

@ -15,7 +15,7 @@ namespace BestEffortLinkGenerationWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<RouteOptions>((options) =>
{
options.UseBestEffortLinkGeneration = true;

View File

@ -17,7 +17,7 @@ namespace CompositeViewEngineWebSite
app.UseServices(services =>
{
// Add a view engine as the first one in the list.
services.AddMvc(configuration)
services.AddMvc()
.Configure<MvcOptions>(options =>
{
options.ViewEngines.Insert(0, typeof(TestViewEngine));

View File

@ -17,7 +17,7 @@ namespace ContentNegotiationWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{

View File

@ -14,7 +14,7 @@ namespace ControllerDiscoveryConventionsWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMvc(routes =>

View File

@ -22,7 +22,7 @@ namespace ControllersFromServicesWebSite
app.UseServices(services =>
{
services.AddMvc(configuration)
services.AddMvc()
.WithControllersAsServices(
new[]
{

View File

@ -14,7 +14,7 @@ namespace CustomRouteWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMvc(routes =>

View File

@ -14,7 +14,7 @@ namespace ErrorPageMiddlewareWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseErrorPage();

View File

@ -14,7 +14,7 @@ namespace FilesWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMiddleware<SendFileMiddleware>();

View File

@ -18,7 +18,7 @@ namespace FiltersWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.ConfigureAuthorization(options =>
{
// This policy cannot succeed since it has no requirements

View File

@ -17,7 +17,7 @@ namespace FormatFilterWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{
var formatFilter = new FormatFilterAttribute();

View File

@ -17,7 +17,7 @@ namespace FormatterWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{

View File

@ -15,7 +15,7 @@ namespace InlineConstraints
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseErrorReporter();

View File

@ -20,7 +20,7 @@ namespace LoggingWebSite
options.Filter = (loggerName, logLevel) => true;
});
services.AddMvc(configuration);
services.AddMvc();
});
app.Map("/logs", (appBuilder) =>

View File

@ -18,7 +18,7 @@ namespace LowercaseUrlsWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<RouteOptions>(routeOptions => routeOptions.LowercaseUrls = true);
});

View File

@ -20,7 +20,7 @@ namespace ModelBindingWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration)
services.AddMvc()
.Configure<MvcOptions>(m =>
{
m.MaxModelValidationErrors = 8;

View File

@ -14,7 +14,7 @@ namespace MvcTagHelpersWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddSingleton<ProductsService>();
});

View File

@ -14,7 +14,7 @@ namespace PrecompilationWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMvc(routes =>

View File

@ -15,7 +15,7 @@ namespace RazorCompilerCacheWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddSingleton<ICompilerCache, CustomCompilerCache>();
services.AddSingleton<CompilerCacheInitialiedService>();
});

View File

@ -17,7 +17,7 @@ namespace RazorEmbeddedViewsWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<RazorViewEngineOptions>(options =>
{

View File

@ -20,7 +20,7 @@ namespace RazorPageExecutionInstrumentationWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
});
app.Use(async (HttpContext context, Func<Task> next) =>

View File

@ -18,7 +18,7 @@ namespace RazorWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.AddTransient<InjectedHelper>();
services.AddTransient<TaskReturningService>();
services.AddTransient<FrameworkSpecificHelper>();

View File

@ -14,7 +14,7 @@ namespace RequestServicesWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddScoped<RequestIdService>();
});

View File

@ -14,7 +14,7 @@ namespace ResponseCacheWebSite
var configuration = app.GetTestConfiguration();
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{
options.CacheProfiles.Add(

View File

@ -14,7 +14,7 @@ namespace RoutingWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddScoped<TestResponseGenerator>();
});

View File

@ -14,7 +14,7 @@ namespace TagHelpersWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMvc(routes =>

View File

@ -16,7 +16,7 @@ namespace TempDataWebSite
{
services.AddCaching();
services.AddSession();
services.AddMvc(configuration);
services.AddMvc();
});
app.UseInMemorySession();

View File

@ -24,7 +24,7 @@ namespace UrlHelperWebSite
});
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.AddScoped<IUrlHelper, CustomUrlHelper>();
});

View File

@ -19,7 +19,7 @@ namespace ValidationWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
});
app.UseErrorReporter();

View File

@ -17,7 +17,7 @@ namespace ValueProvidersWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration)
services.AddMvc()
.Configure<MvcOptions>(options =>
{
options.ValueProviderFactories.Insert(1, new CustomValueProviderFactory());

View File

@ -14,7 +14,7 @@ namespace VersioningWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddScoped<TestResponseGenerator>();
});

View File

@ -13,7 +13,7 @@ namespace ViewComponentWebSite
var configuration = app.GetTestConfiguration();
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
});
app.UseMvc(routes =>

View File

@ -15,7 +15,7 @@ namespace WebApiCompatShimWebSite
app.UseServices(services =>
{
services.AddMvc(configuration);
services.AddMvc();
services.AddWebApiConventions();
});

View File

@ -20,7 +20,7 @@ namespace XmlFormattersWebSite
app.UseServices(services =>
{
// Add MVC services to the services container
services.AddMvc(configuration);
services.AddMvc();
services.Configure<MvcOptions>(options =>
{