// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.Framework.DependencyInjection; namespace Microsoft.AspNet.Mvc { /// /// that uses type activation to create controllers. /// public class DefaultControllerActivator : IControllerActivator { private readonly ITypeActivatorCache _typeActivatorCache; /// /// Creates a new . /// /// The . public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache) { _typeActivatorCache = typeActivatorCache; } /// public object Create([NotNull] ActionContext actionContext, [NotNull] Type controllerType) { var serviceProvider = actionContext.HttpContext.RequestServices; return _typeActivatorCache.CreateInstance(serviceProvider, controllerType); } } }