React to DI changes
This commit is contained in:
parent
c632c8a6a4
commit
7adf11b7bc
|
|
@ -13,33 +13,30 @@ namespace Microsoft.Framework.DependencyInjection
|
|||
public static class HostingServicesExtensions
|
||||
{
|
||||
// REVIEW: Logging doesn't depend on DI, where should this live?
|
||||
public static IServiceCollection AddLogging(this IServiceCollection services, IConfiguration config = null)
|
||||
public static IServiceCollection AddLogging(this IServiceCollection services)
|
||||
{
|
||||
var describe = new ServiceDescriber(config);
|
||||
services.TryAdd(describe.Singleton<ILoggerFactory, LoggerFactory>());
|
||||
services.TryAdd(describe.Singleton(typeof(ILogger<>), typeof(Logger<>)));
|
||||
services.TryAdd(ServiceDescriptor.Singleton<ILoggerFactory, LoggerFactory>());
|
||||
services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddHosting(this IServiceCollection services, IConfiguration configuration = null)
|
||||
{
|
||||
var describer = new ServiceDescriber(configuration);
|
||||
services.TryAdd(ServiceDescriptor.Transient<IHostingEngine, HostingEngine>());
|
||||
services.TryAdd(ServiceDescriptor.Transient<IServerLoader, ServerLoader>());
|
||||
|
||||
services.TryAdd(describer.Transient<IHostingEngine, HostingEngine>());
|
||||
services.TryAdd(describer.Transient<IServerLoader, ServerLoader>());
|
||||
services.TryAdd(ServiceDescriptor.Transient<IStartupLoader, StartupLoader>());
|
||||
|
||||
services.TryAdd(describer.Transient<IStartupLoader, StartupLoader>());
|
||||
services.TryAdd(ServiceDescriptor.Transient<IApplicationBuilderFactory, ApplicationBuilderFactory>());
|
||||
services.TryAdd(ServiceDescriptor.Transient<IHttpContextFactory, HttpContextFactory>());
|
||||
|
||||
services.TryAdd(describer.Transient<IApplicationBuilderFactory, ApplicationBuilderFactory>());
|
||||
services.TryAdd(describer.Transient<IHttpContextFactory, HttpContextFactory>());
|
||||
|
||||
services.TryAdd(describer.Instance<IApplicationLifetime>(new ApplicationLifetime()));
|
||||
services.TryAdd(ServiceDescriptor.Instance<IApplicationLifetime>(new ApplicationLifetime()));
|
||||
|
||||
services.AddTypeActivator(configuration);
|
||||
// TODO: Do we expect this to be provide by the runtime eventually?
|
||||
services.AddLogging(configuration);
|
||||
services.TryAdd(describer.Singleton<IHostingEnvironment, HostingEnvironment>());
|
||||
services.TryAdd(describer.Singleton<IHttpContextAccessor, HttpContextAccessor>());
|
||||
services.AddLogging();
|
||||
services.TryAdd(ServiceDescriptor.Singleton<IHostingEnvironment, HostingEnvironment>());
|
||||
services.TryAdd(ServiceDescriptor.Singleton<IHttpContextAccessor, HttpContextAccessor>());
|
||||
|
||||
// REVIEW: don't try add because we pull out IEnumerable<IConfigureHostingEnvironment>?
|
||||
services.AddInstance<IConfigureHostingEnvironment>(new ConfigureHostingEnvironment(configuration));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Microsoft.Framework.Runtime;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
|
||||
namespace Microsoft.AspNet.Hosting.Startup
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||
using Microsoft.AspNet.RequestContainer;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
|
||||
namespace Microsoft.AspNet.Builder
|
||||
{
|
||||
|
|
@ -29,7 +28,7 @@ namespace Microsoft.AspNet.Builder
|
|||
|
||||
// Note: Manifests are lost after UseServices, services are flattened into ApplicationServices
|
||||
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, IEnumerable<IServiceDescriptor> applicationServices)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, IServiceCollection applicationServices)
|
||||
{
|
||||
return builder.UseServices(services => services.Add(applicationServices));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ using Microsoft.AspNet.Hosting.Server;
|
|||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using Microsoft.Framework.Runtime.Infrastructure;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using System;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ using Microsoft.AspNet.FeatureModel;
|
|||
using Microsoft.AspNet.Hosting.Server;
|
||||
using Microsoft.Framework.ConfigurationModel;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Hosting
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Hosting.Fakes;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.Runtime;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Microsoft.AspNet.Builder;
|
|||
using Microsoft.AspNet.Hosting.Fakes;
|
||||
using Microsoft.AspNet.Hosting.Startup;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.OptionsModel;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Microsoft.AspNet.Builder;
|
|||
using Microsoft.AspNet.Http.Core;
|
||||
using Microsoft.AspNet.RequestContainer;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.Logging;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.TestHost
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ using Microsoft.AspNet.Builder;
|
|||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.TestHost
|
||||
|
|
|
|||
Loading…
Reference in New Issue