React to UsePerRequestServices

This commit is contained in:
Hao Kung 2014-10-09 14:16:17 -07:00
parent c87de5a0fc
commit b6bd7f5d78
25 changed files with 27 additions and 27 deletions

View File

@ -31,7 +31,7 @@ namespace MvcSample.Web
{ {
app.UseMiddleware<MonitoringMiddlware>(); app.UseMiddleware<MonitoringMiddlware>();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(); services.AddMvc();
services.AddSingleton<PassThroughAttribute>(); services.AddSingleton<PassThroughAttribute>();
@ -72,7 +72,7 @@ namespace MvcSample.Web
else else
#endif #endif
{ {
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(); services.AddMvc();
services.AddSingleton<PassThroughAttribute>(); services.AddSingleton<PassThroughAttribute>();

View File

@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.Internal
{ {
throw new InvalidOperationException(Resources.FormatUnableToFindServices( throw new InvalidOperationException(Resources.FormatUnableToFindServices(
"IServiceCollection.AddMvc()", "IServiceCollection.AddMvc()",
"IApplicationBuilder.UseServices(...)", "IApplicationBuilder.UsePerRequestServices(...)",
"IApplicationBuilder.UseMvc(...)")); "IApplicationBuilder.UseMvc(...)"));
} }
} }

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc
= new ResourceManager("Microsoft.AspNet.Mvc.Resources", typeof(Resources).GetTypeInfo().Assembly); = new ResourceManager("Microsoft.AspNet.Mvc.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary> /// <summary>
/// Unable to find the required services. Please add all the required services by calling AddMvc() before calling UseMvc()/UseServices() in the Application Startup. /// Unable to find the required services. Please add all the required services by calling AddMvc() before calling UseMvc()/UsePerRequestServices() in the Application Startup.
/// </summary> /// </summary>
internal static string UnableToFindServices internal static string UnableToFindServices
{ {
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc
} }
/// <summary> /// <summary>
/// Unable to find the required services. Please add all the required services by calling AddMvc() before calling UseMvc()/UseServices() in the Application Startup. /// Unable to find the required services. Please add all the required services by calling AddMvc() before calling UseMvc()/UsePerRequestServices() in the Application Startup.
/// </summary> /// </summary>
internal static string FormatUnableToFindServices() internal static string FormatUnableToFindServices()
{ {

View File

@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Mvc
services.Setup(o => o.GetService(typeof(IEnumerable<MvcMarkerService>))) services.Setup(o => o.GetService(typeof(IEnumerable<MvcMarkerService>)))
.Returns(new List<MvcMarkerService>()); .Returns(new List<MvcMarkerService>());
var expectedMessage = "Unable to find the required services. Please add all the required " + var expectedMessage = "Unable to find the required services. Please add all the required " +
"services by calling 'IServiceCollection.AddMvc()' inside the call to 'IApplicationBuilder.UseServices(...)' " + "services by calling 'IServiceCollection.AddMvc()' inside the call to 'IApplicationBuilder.UsePerRequestServices(...)' " +
"or 'IApplicationBuilder.UseMvc(...)' in the application startup code."; "or 'IApplicationBuilder.UseMvc(...)' in the application startup code.";
// Act & Assert // Act & Assert

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
{ {
// Arrange // Arrange
var expectedMessage = "Unable to find the required services. Please add all the required " + var expectedMessage = "Unable to find the required services. Please add all the required " +
"services by calling 'IServiceCollection.AddMvc()' inside the call to 'IApplicationBuilder.UseServices(...)' " + "services by calling 'IServiceCollection.AddMvc()' inside the call to 'IApplicationBuilder.UsePerRequestServices(...)' " +
"or 'IApplicationBuilder.UseMvc(...)' in the application startup code."; "or 'IApplicationBuilder.UseMvc(...)' in the application startup code.";
// Act & Assert // Act & Assert

View File

@ -14,7 +14,7 @@ namespace ActivatorWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -9,7 +9,7 @@ namespace AntiForgeryWebSite
public void Configure(IApplicationBuilder app) public void Configure(IApplicationBuilder app)
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(configuration); services.AddMvc(configuration);
}); });

View File

@ -14,7 +14,7 @@ namespace ApiExplorer
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(configuration); services.AddMvc(configuration);
services.AddSingleton<ApiExplorerDataFilter>(); services.AddSingleton<ApiExplorerDataFilter>();

View File

@ -12,7 +12,7 @@ namespace ApplicationModelWebSite
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(configuration); services.AddMvc(configuration);
}); });

View File

@ -13,7 +13,7 @@ namespace AutofacWebSite
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => { app.UsePerRequestServices(services => {
services.AddMvc(configuration); services.AddMvc(configuration);
services.AddTransient<HelloWorldBuilder>(); services.AddTransient<HelloWorldBuilder>();

View File

@ -13,7 +13,7 @@ namespace BasicWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -14,7 +14,7 @@ namespace CompositeViewEngine
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(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(configuration)

View File

@ -14,7 +14,7 @@ namespace ConnegWebsite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

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

View File

@ -15,7 +15,7 @@ namespace FiltersWebSite
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -14,7 +14,7 @@ namespace FormatterWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -38,7 +38,7 @@ namespace InlineConstraints
} }
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -15,7 +15,7 @@ namespace ModelBindingWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration) services.AddMvc(configuration)

View File

@ -17,7 +17,7 @@ namespace RazorInstrumentationWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -12,7 +12,7 @@ namespace RazorWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);

View File

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

View File

@ -15,7 +15,7 @@ namespace UrlHelperWebSite
configuration.AddJsonFile("config.json"); configuration.AddJsonFile("config.json");
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.ConfigureOptions<AppOptions>(optionsSetup => services.ConfigureOptions<AppOptions>(optionsSetup =>
{ {

View File

@ -14,7 +14,7 @@ namespace ValueProvidersSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration) services.AddMvc(configuration)

View File

@ -12,7 +12,7 @@ namespace VersioningWebSite
{ {
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
services.AddMvc(configuration); services.AddMvc(configuration);

View File

@ -15,7 +15,7 @@ namespace XmlSerializerWebSite
var configuration = app.GetTestConfiguration(); var configuration = app.GetTestConfiguration();
// Set up application services // Set up application services
app.UseServices(services => app.UsePerRequestServices(services =>
{ {
// Add MVC services to the services container // Add MVC services to the services container
services.AddMvc(configuration); services.AddMvc(configuration);