using System; using System.Collections.Generic; using Microsoft.AspNet.ConfigurationModel; using Microsoft.AspNet.DependencyInjection; using Microsoft.AspNet.DependencyInjection.NestedProviders; using Microsoft.AspNet.FileSystems; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Razor; using Microsoft.Net.Runtime; namespace Microsoft.AspNet.Mvc { public class MvcServices { public static IEnumerable GetDefaultServices(IConfiguration configuration, IApplicationEnvironment env) { var describe = new ServiceDescriber(configuration); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Instance(new PhysicalFileSystem(env.ApplicationBasePath)); yield return describe.Instance(new MvcRazorHost(typeof(RazorView).FullName)); #if NET45 // TODO: Container chaining to flow services from the host to this container yield return describe.Transient(); // TODO: Make this work like normal when we get container chaining // TODO: Update this when we have the new host services // yield return describe.Instance(new RoslynCompilationService(hostServiceProvider)); #endif yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); // This is temporary until DI has some magic for it yield return describe.Transient, NestedProviderManager>(); yield return describe.Transient, NestedProviderManager>(); yield return describe.Transient, ReflectedActionDescriptorProvider>(); yield return describe.Transient, ReflectedActionInvokerProvider>(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient(); yield return describe.Transient, NestedProviderManager>(); yield return describe.Transient, DefaultFilterProvider>(); yield return describe.Transient(); } } }