An `ObjectPoolProvider` is always registered
- react to aspnet/Hosting/pull#673
This commit is contained in:
parent
476d2eb81d
commit
43836aec18
|
|
@ -4,9 +4,7 @@
|
|||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters.Json.Internal;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
@ -55,7 +53,6 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
services.TryAddEnumerable(
|
||||
ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, MvcJsonMvcOptionsSetup>());
|
||||
services.TryAddSingleton<JsonResultExecutor>();
|
||||
services.TryAddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.WebEncoders.Testing;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
|
@ -195,6 +196,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
|||
|
||||
var services = new ServiceCollection()
|
||||
.AddSingleton<IInlineConstraintResolver>(new DefaultInlineConstraintResolver(routeOptions.Object))
|
||||
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
|
||||
.AddSingleton<UrlEncoder>(new UrlTestEncoder());
|
||||
|
||||
services.AddRouting();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Http.Internal;
|
|||
using Microsoft.AspNetCore.Mvc.Abstractions;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -1030,7 +1031,10 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
services.AddOptions();
|
||||
services.AddLogging();
|
||||
services.AddRouting();
|
||||
services.AddSingleton<UrlEncoder>(UrlEncoder.Default);
|
||||
services
|
||||
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
|
||||
.AddSingleton<UrlEncoder>(UrlEncoder.Default);
|
||||
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Internal;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
|
|
@ -12,6 +11,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
|||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.IntegrationTests
|
||||
|
|
@ -83,7 +83,9 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
|
|||
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddMvc();
|
||||
serviceCollection.AddTransient<ILoggerFactory, LoggerFactory>();
|
||||
serviceCollection
|
||||
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
|
||||
.AddTransient<ILoggerFactory, LoggerFactory>();
|
||||
|
||||
if (updateOptions != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using Microsoft.AspNetCore.Mvc.Razor;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
|
@ -233,7 +234,9 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddMvc();
|
||||
serviceCollection.AddTransient<ILoggerFactory, LoggerFactory>();
|
||||
serviceCollection
|
||||
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
|
||||
.AddTransient<ILoggerFactory, LoggerFactory>();
|
||||
|
||||
if (action != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.WebEncoders.Testing;
|
||||
using Moq;
|
||||
|
|
@ -1038,8 +1039,10 @@ namespace Microsoft.AspNetCore.Mvc
|
|||
private static ServiceCollection GetServiceCollection(IStringLocalizerFactory localizerFactory)
|
||||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddSingleton<ILoggerFactory>(new NullLoggerFactory());
|
||||
serviceCollection.AddSingleton<UrlEncoder>(new UrlTestEncoder());
|
||||
serviceCollection
|
||||
.AddSingleton<ObjectPoolProvider, DefaultObjectPoolProvider>()
|
||||
.AddSingleton<ILoggerFactory>(new NullLoggerFactory())
|
||||
.AddSingleton<UrlEncoder>(new UrlTestEncoder());
|
||||
|
||||
serviceCollection.AddOptions();
|
||||
serviceCollection.AddRouting();
|
||||
|
|
|
|||
Loading…
Reference in New Issue