React to DI
This commit is contained in:
parent
b581ff343c
commit
c290e897b0
|
|
@ -130,9 +130,9 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
|
|
||||||
private static void ConfigureDefaultServices(IServiceCollection services, IConfiguration configuration)
|
private static void ConfigureDefaultServices(IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
services.AddOptions(configuration);
|
services.AddOptions();
|
||||||
services.AddDataProtection(configuration);
|
services.AddDataProtection();
|
||||||
services.AddRouting(configuration);
|
services.AddRouting();
|
||||||
services.AddAuthorization(configuration);
|
services.AddAuthorization(configuration);
|
||||||
services.AddWebEncoders();
|
services.AddWebEncoders();
|
||||||
services.Configure<RouteOptions>(routeOptions =>
|
services.Configure<RouteOptions>(routeOptions =>
|
||||||
|
|
@ -141,4 +141,4 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
typeof(KnownRouteValueConstraint)));
|
typeof(KnownRouteValueConstraint)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,12 +25,12 @@ namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
public class MvcServices
|
public class MvcServices
|
||||||
{
|
{
|
||||||
public static IEnumerable<IServiceDescriptor> GetDefaultServices()
|
public static IEnumerable<ServiceDescriptor> GetDefaultServices()
|
||||||
{
|
{
|
||||||
return GetDefaultServices(null);
|
return GetDefaultServices(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration)
|
public static IEnumerable<ServiceDescriptor> GetDefaultServices(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var describe = new ServiceDescriber(configuration);
|
var describe = new ServiceDescriber(configuration);
|
||||||
|
|
||||||
|
|
@ -172,4 +172,4 @@ namespace Microsoft.AspNet.Mvc
|
||||||
yield return describe.Transient<IApiDescriptionProvider, DefaultApiDescriptionProvider>();
|
yield return describe.Transient<IApiDescriptionProvider, DefaultApiDescriptionProvider>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis;
|
||||||
using Microsoft.CodeAnalysis.CSharp;
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
using Microsoft.Framework.Cache.Memory;
|
using Microsoft.Framework.Cache.Memory;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.Runtime;
|
using Microsoft.Framework.Runtime;
|
||||||
using Microsoft.Framework.Runtime.Roslyn;
|
using Microsoft.Framework.Runtime.Roslyn;
|
||||||
|
|
||||||
|
|
@ -63,7 +62,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
|
|
||||||
// TODO: KILL THIS
|
// TODO: KILL THIS
|
||||||
private static IServiceProvider BuildFallbackServiceProvider(
|
private static IServiceProvider BuildFallbackServiceProvider(
|
||||||
IEnumerable<IServiceDescriptor> services,
|
IServiceCollection services,
|
||||||
IServiceProvider fallback)
|
IServiceProvider fallback)
|
||||||
{
|
{
|
||||||
var sc = HostingServices.Create(fallback);
|
var sc = HostingServices.Create(fallback);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using Microsoft.AspNet.Http.Core;
|
||||||
using Microsoft.AspNet.Http.Interfaces;
|
using Microsoft.AspNet.Http.Interfaces;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ using Microsoft.AspNet.Http.Core;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.AspNet.WebUtilities;
|
using Microsoft.AspNet.WebUtilities;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ using Microsoft.AspNet.Mvc.Xml;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.AspNet.WebUtilities;
|
using Microsoft.AspNet.WebUtilities;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ using System;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using Microsoft.AspNet.DataProtection;
|
using Microsoft.AspNet.DataProtection;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Microsoft.Framework.WebEncoders;
|
using Microsoft.Framework.WebEncoders;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.AspNet.WebUtilities;
|
using Microsoft.AspNet.WebUtilities;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using Microsoft.AspNet.Http.Core;
|
||||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.DependencyInjection.ServiceLookup;
|
using Microsoft.Framework.DependencyInjection.ServiceLookup;
|
||||||
using Microsoft.Framework.Logging;
|
using Microsoft.Framework.Logging;
|
||||||
using Microsoft.Framework.Runtime;
|
using Microsoft.Framework.Runtime;
|
||||||
|
|
@ -117,7 +116,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Kill this code
|
// TODO: Kill this code
|
||||||
private static IServiceProvider BuildFallbackServiceProvider(IEnumerable<IServiceDescriptor> services, IServiceProvider fallback)
|
private static IServiceProvider BuildFallbackServiceProvider(IEnumerable<ServiceDescriptor> services, IServiceProvider fallback)
|
||||||
{
|
{
|
||||||
var sc = HostingServices.Create(fallback);
|
var sc = HostingServices.Create(fallback);
|
||||||
sc.Add(services);
|
sc.Add(services);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ using Microsoft.AspNet.Http.Core;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding.Test
|
namespace Microsoft.AspNet.Mvc.ModelBinding.Test
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
#if ASPNET50
|
#if ASPNET50
|
||||||
using Moq;
|
using Moq;
|
||||||
using Moq.Protected;
|
using Moq.Protected;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Testing;
|
using Microsoft.AspNet.Testing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.OptionsModel;
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,20 +30,20 @@ namespace Microsoft.AspNet.Mvc
|
||||||
Assert.Equal(4, services.Count);
|
Assert.Equal(4, services.Count);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[0].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[0].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[1].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[1].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
||||||
Assert.Equal(typeof(ServiceBasedControllerActivator), services[2].ImplementationType);
|
Assert.Equal(typeof(ServiceBasedControllerActivator), services[2].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[2].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[2].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
||||||
var typeProvider = Assert.IsType<FixedSetControllerTypeProvider>(services[3].ImplementationInstance);
|
var typeProvider = Assert.IsType<FixedSetControllerTypeProvider>(services[3].ImplementationInstance);
|
||||||
Assert.Equal(controllerTypes, typeProvider.ControllerTypes.OrderBy(c => c.Name));
|
Assert.Equal(controllerTypes, typeProvider.ControllerTypes.OrderBy(c => c.Name));
|
||||||
Assert.Equal(LifecycleKind.Singleton, services[3].Lifecycle);
|
Assert.Equal(ServiceLifetime.Singleton, services[3].Lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -69,19 +69,19 @@ namespace Microsoft.AspNet.Mvc
|
||||||
Assert.Equal(4, services.Count);
|
Assert.Equal(4, services.Count);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[0].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[0].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[1].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[1].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
||||||
Assert.Equal(typeof(CustomActivator), services[2].ImplementationType);
|
Assert.Equal(typeof(CustomActivator), services[2].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[2].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[2].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
||||||
Assert.Equal(typeof(CustomTypeProvider), services[3].ImplementationType);
|
Assert.Equal(typeof(CustomTypeProvider), services[3].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Singleton, services[3].Lifecycle);
|
Assert.Equal(ServiceLifetime.Singleton, services[3].Lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -102,21 +102,21 @@ namespace Microsoft.AspNet.Mvc
|
||||||
Assert.Equal(4, services.Count);
|
Assert.Equal(4, services.Count);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ServiceType);
|
||||||
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
Assert.Equal(typeof(ControllerTypeA), services[0].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[0].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[0].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
Assert.Equal(typeof(TypeBController), services[1].ServiceType);
|
||||||
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
Assert.Equal(typeof(TypeBController), services[1].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[1].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[1].Lifetime);
|
||||||
|
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
Assert.Equal(typeof(IControllerActivator), services[2].ServiceType);
|
||||||
Assert.Equal(typeof(ServiceBasedControllerActivator), services[2].ImplementationType);
|
Assert.Equal(typeof(ServiceBasedControllerActivator), services[2].ImplementationType);
|
||||||
Assert.Equal(LifecycleKind.Transient, services[2].Lifecycle);
|
Assert.Equal(ServiceLifetime.Transient, services[2].Lifetime);
|
||||||
|
|
||||||
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
Assert.Equal(typeof(IControllerTypeProvider), services[3].ServiceType);
|
||||||
var typeProvider = Assert.IsType<FixedSetControllerTypeProvider>(services[3].ImplementationInstance);
|
var typeProvider = Assert.IsType<FixedSetControllerTypeProvider>(services[3].ImplementationInstance);
|
||||||
Assert.Equal(controllerTypes, typeProvider.ControllerTypes.OrderBy(c => c.Name));
|
Assert.Equal(controllerTypes, typeProvider.ControllerTypes.OrderBy(c => c.Name));
|
||||||
Assert.Equal(LifecycleKind.Singleton, services[3].Lifecycle);
|
Assert.Equal(ServiceLifetime.Singleton, services[3].Lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CustomActivator : IControllerActivator
|
private class CustomActivator : IControllerActivator
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using System.Runtime.Versioning;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.DependencyInjection.Fallback;
|
|
||||||
using Microsoft.Framework.Runtime;
|
using Microsoft.Framework.Runtime;
|
||||||
|
|
||||||
namespace PrecompilationWebSite
|
namespace PrecompilationWebSite
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue