Handle IBuilder rename to IApplicationBuilder.
This commit is contained in:
parent
f4953a0b29
commit
200f894b5b
|
|
@ -17,22 +17,21 @@
|
|||
|
||||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Hosting.Builder
|
||||
{
|
||||
public class BuilderFactory : IBuilderFactory
|
||||
public class ApplicationBuilderFactory : IApplicationBuilderFactory
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public BuilderFactory(IServiceProvider serviceProvider)
|
||||
public ApplicationBuilderFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public IBuilder CreateBuilder()
|
||||
public IApplicationBuilder CreateBuilder()
|
||||
{
|
||||
return new Microsoft.AspNet.Builder.Builder(_serviceProvider);
|
||||
return new ApplicationBuilder(_serviceProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,12 +16,11 @@
|
|||
// permissions and limitations under the License.
|
||||
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
|
||||
namespace Microsoft.AspNet.Hosting.Builder
|
||||
{
|
||||
public interface IBuilderFactory
|
||||
public interface IApplicationBuilderFactory
|
||||
{
|
||||
IBuilder CreateBuilder();
|
||||
IApplicationBuilder CreateBuilder();
|
||||
}
|
||||
}
|
||||
|
|
@ -28,11 +28,11 @@ namespace Microsoft.AspNet.Hosting
|
|||
public IServiceProvider Services { get; set; }
|
||||
public IConfiguration Configuration { get; set; }
|
||||
|
||||
public IBuilder Builder { get; set; }
|
||||
public IApplicationBuilder Builder { get; set; }
|
||||
|
||||
public string ApplicationName { get; set; }
|
||||
public string EnvironmentName { get; set; }
|
||||
public Action<IBuilder> ApplicationStartup { get; set; }
|
||||
public Action<IApplicationBuilder> ApplicationStartup { get; set; }
|
||||
public RequestDelegate ApplicationDelegate { get; set; }
|
||||
|
||||
public string ServerName { get; set; }
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ namespace Microsoft.AspNet.Hosting
|
|||
{
|
||||
private readonly IServerManager _serverManager;
|
||||
private readonly IStartupManager _startupManager;
|
||||
private readonly IBuilderFactory _builderFactory;
|
||||
private readonly IApplicationBuilderFactory _builderFactory;
|
||||
private readonly IHttpContextFactory _httpContextFactory;
|
||||
|
||||
public HostingEngine(
|
||||
IServerManager serverManager,
|
||||
IStartupManager startupManager,
|
||||
IBuilderFactory builderFactory,
|
||||
IApplicationBuilderFactory builderFactory,
|
||||
IHttpContextFactory httpContextFactory)
|
||||
{
|
||||
_serverManager = serverManager;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Hosting
|
|||
yield return describer.Transient<IStartupManager, StartupManager>();
|
||||
yield return describer.Transient<IStartupLoaderProvider, StartupLoaderProvider>();
|
||||
|
||||
yield return describer.Transient<IBuilderFactory, BuilderFactory>();
|
||||
yield return describer.Transient<IApplicationBuilderFactory, ApplicationBuilderFactory>();
|
||||
yield return describer.Transient<IHttpContextFactory, HttpContextFactory>();
|
||||
|
||||
yield return describer.Transient<ITypeActivator, TypeActivator>();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
{
|
||||
public interface IStartupLoader
|
||||
{
|
||||
Action<IBuilder> LoadStartup(
|
||||
Action<IApplicationBuilder> LoadStartup(
|
||||
string applicationName,
|
||||
string environmentName,
|
||||
IList<string> diagnosticMessages);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
{
|
||||
public interface IStartupManager
|
||||
{
|
||||
Action<IBuilder> LoadStartup(
|
||||
Action<IApplicationBuilder> LoadStartup(
|
||||
string applicationName,
|
||||
string environmentName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
|
||||
public static IStartupLoader Instance { get; private set; }
|
||||
|
||||
public Action<IBuilder> LoadStartup(
|
||||
public Action<IApplicationBuilder> LoadStartup(
|
||||
string applicationName,
|
||||
string environmentName,
|
||||
IList<string> diagnosticMessages)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
_next = next;
|
||||
}
|
||||
|
||||
public Action<IBuilder> LoadStartup(
|
||||
public Action<IApplicationBuilder> LoadStartup(
|
||||
string applicationName,
|
||||
string environmentName,
|
||||
IList<string> diagnosticMessages)
|
||||
|
|
@ -120,7 +120,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
for (var index = 0; index != parameterInfos.Length; ++index)
|
||||
{
|
||||
var parameterInfo = parameterInfos[index];
|
||||
if (parameterInfo.ParameterType == typeof(IBuilder))
|
||||
if (parameterInfo.ParameterType == typeof(IApplicationBuilder))
|
||||
{
|
||||
parameters[index] = builder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Hosting.Startup
|
|||
_providers = providers;
|
||||
}
|
||||
|
||||
public Action<IBuilder> LoadStartup(
|
||||
public Action<IApplicationBuilder> LoadStartup(
|
||||
string applicationName,
|
||||
string environmentName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ namespace Microsoft.AspNet.Builder
|
|||
{
|
||||
public static class ContainerExtensions
|
||||
{
|
||||
public static IBuilder UseMiddleware<T>(this IBuilder builder, params object[] args)
|
||||
public static IApplicationBuilder UseMiddleware<T>(this IApplicationBuilder builder, params object[] args)
|
||||
{
|
||||
return builder.UseMiddleware(typeof(T), args);
|
||||
}
|
||||
|
||||
public static IBuilder UseMiddleware(this IBuilder builder, Type middleware, params object[] args)
|
||||
public static IApplicationBuilder UseMiddleware(this IApplicationBuilder builder, Type middleware, params object[] args)
|
||||
{
|
||||
// TODO: move this ext method someplace nice
|
||||
return builder.Use(next =>
|
||||
|
|
@ -45,24 +45,24 @@ namespace Microsoft.AspNet.Builder
|
|||
});
|
||||
}
|
||||
|
||||
public static IBuilder UseServices(this IBuilder builder)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseMiddleware(typeof(ContainerMiddleware));
|
||||
}
|
||||
|
||||
public static IBuilder UseServices(this IBuilder builder, IServiceProvider applicationServices)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, IServiceProvider applicationServices)
|
||||
{
|
||||
builder.ApplicationServices = applicationServices;
|
||||
|
||||
return builder.UseMiddleware(typeof(ContainerMiddleware));
|
||||
}
|
||||
|
||||
public static IBuilder UseServices(this IBuilder builder, IEnumerable<IServiceDescriptor> applicationServices)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, IEnumerable<IServiceDescriptor> applicationServices)
|
||||
{
|
||||
return builder.UseServices(services => services.Add(applicationServices));
|
||||
}
|
||||
|
||||
public static IBuilder UseServices(this IBuilder builder, Action<ServiceCollection> configureServices)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, Action<ServiceCollection> configureServices)
|
||||
{
|
||||
return builder.UseServices(serviceCollection =>
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Builder
|
|||
});
|
||||
}
|
||||
|
||||
public static IBuilder UseServices(this IBuilder builder, Func<ServiceCollection, IServiceProvider> configureServices)
|
||||
public static IApplicationBuilder UseServices(this IApplicationBuilder builder, Func<ServiceCollection, IServiceProvider> configureServices)
|
||||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.TestHost
|
|||
private IDisposable _appInstance;
|
||||
private bool _disposed = false;
|
||||
|
||||
public TestServer(IConfiguration config, IServiceProvider serviceProvider, Action<IBuilder> appStartup)
|
||||
public TestServer(IConfiguration config, IServiceProvider serviceProvider, Action<IApplicationBuilder> appStartup)
|
||||
{
|
||||
var env = serviceProvider.GetService<IApplicationEnvironment>();
|
||||
if (env == null)
|
||||
|
|
@ -44,12 +44,12 @@ namespace Microsoft.AspNet.TestHost
|
|||
_appInstance = engine.Start(hostContext);
|
||||
}
|
||||
|
||||
public static TestServer Create(Action<IBuilder> app)
|
||||
public static TestServer Create(Action<IApplicationBuilder> app)
|
||||
{
|
||||
return Create(provider: CallContextServiceLocator.Locator.ServiceProvider, app: app);
|
||||
}
|
||||
|
||||
public static TestServer Create(IServiceProvider provider, Action<IBuilder> app)
|
||||
public static TestServer Create(IServiceProvider provider, Action<IApplicationBuilder> app)
|
||||
{
|
||||
var collection = new ServiceCollection();
|
||||
var hostingServices = HostingServices.GetDefaultServices();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Hosting.Fakes
|
|||
{
|
||||
}
|
||||
|
||||
public void Configure(IBuilder builder)
|
||||
public void Configure(IApplicationBuilder builder)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Hosting.Fakes
|
|||
_fakeStartupCallback = fakeStartupCallback;
|
||||
}
|
||||
|
||||
public void Configure(IBuilder builder, IFakeStartupCallback fakeStartupCallback2)
|
||||
public void Configure(IApplicationBuilder builder, IFakeStartupCallback fakeStartupCallback2)
|
||||
{
|
||||
_fakeStartupCallback.ConfigurationMethodCalled(this);
|
||||
fakeStartupCallback2.ConfigurationMethodCalled(this);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Hosting
|
|||
Assert.Equal(1, _startInstances[0].DisposeCalls);
|
||||
}
|
||||
|
||||
public void Initialize(IBuilder builder)
|
||||
public void Initialize(IApplicationBuilder builder)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Hosting.Tests
|
|||
public void OptionsAccessorCanBeResolvedAfterCallingUseServicesWithAction()
|
||||
{
|
||||
var baseServiceProvider = new ServiceCollection().BuildServiceProvider();
|
||||
var builder = new Microsoft.AspNet.Builder.Builder(baseServiceProvider);
|
||||
var builder = new ApplicationBuilder(baseServiceProvider);
|
||||
|
||||
builder.UseServices(serviceCollection => { });
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Hosting.Tests
|
|||
public void OptionsAccessorCanBeResolvedAfterCallingUseServicesWithFunc()
|
||||
{
|
||||
var baseServiceProvider = new ServiceCollection().BuildServiceProvider();
|
||||
var builder = new Microsoft.AspNet.Builder.Builder(baseServiceProvider);
|
||||
var builder = new ApplicationBuilder(baseServiceProvider);
|
||||
IServiceProvider serviceProvider = null;
|
||||
|
||||
builder.UseServices(serviceCollection =>
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNet.TestHost
|
|||
|
||||
public class Startup
|
||||
{
|
||||
public void Configuration(IBuilder builder)
|
||||
public void Configuration(IApplicationBuilder builder)
|
||||
{
|
||||
builder.Run(ctx => ctx.Response.WriteAsync("Startup"));
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ namespace Microsoft.AspNet.TestHost
|
|||
|
||||
public class AnotherStartup
|
||||
{
|
||||
public void Configuration(IBuilder builder)
|
||||
public void Configuration(IApplicationBuilder builder)
|
||||
{
|
||||
builder.Run(ctx => ctx.Response.WriteAsync("Another Startup"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue