Remove ConfigureServicesDelegate
- Removed the delegate type as it's not used anywhere in user code - Also removed platform helper
This commit is contained in:
parent
0e87d989d7
commit
3124cdd641
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -9,8 +9,6 @@ using Microsoft.Framework.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Hosting.Startup
|
namespace Microsoft.AspNet.Hosting.Startup
|
||||||
{
|
{
|
||||||
public delegate IServiceProvider ConfigureServicesDelegate(IServiceCollection services);
|
|
||||||
|
|
||||||
public class ConfigureServicesBuilder
|
public class ConfigureServicesBuilder
|
||||||
{
|
{
|
||||||
public ConfigureServicesBuilder([NotNull] MethodInfo configureServices)
|
public ConfigureServicesBuilder([NotNull] MethodInfo configureServices)
|
||||||
|
|
@ -28,7 +26,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
||||||
|
|
||||||
public MethodInfo MethodInfo { get; }
|
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)
|
private IServiceProvider Invoke(object instance, [NotNull] IServiceCollection exportServices)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,20 @@ namespace Microsoft.AspNet.Hosting.Startup
|
||||||
{
|
{
|
||||||
public class StartupMethods
|
public class StartupMethods
|
||||||
{
|
{
|
||||||
internal static ConfigureServicesDelegate DefaultBuildServiceProvider = s => s.BuildServiceProvider();
|
internal static Func<IServiceCollection, IServiceProvider> DefaultBuildServiceProvider = s => s.BuildServiceProvider();
|
||||||
|
|
||||||
public StartupMethods(Action<IApplicationBuilder> configure)
|
public StartupMethods(Action<IApplicationBuilder> configure)
|
||||||
: this(configure, configureServices: null) { }
|
: this(configure, configureServices: null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: switch to ConfigureDelegate eventually
|
public StartupMethods(Action<IApplicationBuilder> configure, Func<IServiceCollection, IServiceProvider> configureServices)
|
||||||
public StartupMethods(Action<IApplicationBuilder> configure, ConfigureServicesDelegate configureServices)
|
|
||||||
{
|
{
|
||||||
ConfigureDelegate = configure;
|
ConfigureDelegate = configure;
|
||||||
ConfigureServicesDelegate = configureServices ?? DefaultBuildServiceProvider;
|
ConfigureServicesDelegate = configureServices ?? DefaultBuildServiceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigureServicesDelegate ConfigureServicesDelegate { get; }
|
public Func<IServiceCollection, IServiceProvider> ConfigureServicesDelegate { get; }
|
||||||
public Action<IApplicationBuilder> ConfigureDelegate { get; }
|
public Action<IApplicationBuilder> ConfigureDelegate { get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
return UseStartup(configureApp, configureServices: null);
|
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);
|
_startup = new StartupMethods(configureApp, configureServices);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue