Remove ConfigureServicesDelegate

- Removed the delegate type as it's not used anywhere in user code
- Also removed platform helper
This commit is contained in:
David Fowler 2015-05-17 10:19:03 -07:00
parent 0e87d989d7
commit 3124cdd641
4 changed files with 9 additions and 30 deletions

View File

@ -1,20 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.Hosting
{
internal static class PlatformHelper
{
private static Lazy<bool> _isMono = new Lazy<bool>(() => Type.GetType("Mono.Runtime") != null);
public static bool IsMono
{
get
{
return _isMono.Value;
}
}
}
}

View File

@ -9,8 +9,6 @@ using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Hosting.Startup
{
public delegate IServiceProvider ConfigureServicesDelegate(IServiceCollection services);
public class ConfigureServicesBuilder
{
public ConfigureServicesBuilder([NotNull] MethodInfo configureServices)
@ -28,7 +26,7 @@ namespace Microsoft.AspNet.Hosting.Startup
public MethodInfo MethodInfo { get; }
public ConfigureServicesDelegate Build(object instance) => services => Invoke(instance, services);
public Func<IServiceCollection, IServiceProvider> Build(object instance) => services => Invoke(instance, services);
private IServiceProvider Invoke(object instance, [NotNull] IServiceCollection exportServices)
{

View File

@ -9,19 +9,20 @@ namespace Microsoft.AspNet.Hosting.Startup
{
public class StartupMethods
{
internal static ConfigureServicesDelegate DefaultBuildServiceProvider = s => s.BuildServiceProvider();
internal static Func<IServiceCollection, IServiceProvider> DefaultBuildServiceProvider = s => s.BuildServiceProvider();
public StartupMethods(Action<IApplicationBuilder> configure)
: this(configure, configureServices: null) { }
public StartupMethods(Action<IApplicationBuilder> configure)
: this(configure, configureServices: null)
{
}
// TODO: switch to ConfigureDelegate eventually
public StartupMethods(Action<IApplicationBuilder> configure, ConfigureServicesDelegate configureServices)
public StartupMethods(Action<IApplicationBuilder> configure, Func<IServiceCollection, IServiceProvider> configureServices)
{
ConfigureDelegate = configure;
ConfigureServicesDelegate = configureServices ?? DefaultBuildServiceProvider;
}
public ConfigureServicesDelegate ConfigureServicesDelegate { get; }
public Func<IServiceCollection, IServiceProvider> ConfigureServicesDelegate { get; }
public Action<IApplicationBuilder> ConfigureDelegate { get; }
}

View File

@ -167,7 +167,7 @@ namespace Microsoft.AspNet.Hosting
return UseStartup(configureApp, configureServices: null);
}
public WebHostBuilder UseStartup([NotNull] Action<IApplicationBuilder> configureApp, ConfigureServicesDelegate configureServices)
public WebHostBuilder UseStartup([NotNull] Action<IApplicationBuilder> configureApp, Func<IServiceCollection, IServiceProvider> configureServices)
{
_startup = new StartupMethods(configureApp, configureServices);
return this;