[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 System.Reflection;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Routing; using Microsoft.AspNet.Routing;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging; using Microsoft.Framework.Logging;
@ -15,11 +14,6 @@ namespace Microsoft.Framework.DependencyInjection
{ {
public static class MvcServiceCollectionExtensions 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) public static IServiceCollection AddMvc([NotNull] this IServiceCollection services)
{ {
ConfigureDefaultServices(services); ConfigureDefaultServices(services);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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