[Fixes #2095] Mark IControllerFactory methods in DefaultControllerFactory as virtual

This commit is contained in:
Kiran Challa 2015-03-05 12:27:47 -08:00
parent 7d1c1ed8eb
commit 9a44e3e08b
2 changed files with 14 additions and 3 deletions

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Mvc
_typeActivatorCache = typeActivatorCache;
}
/// <inheritdoc />
public object Create([NotNull] ActionContext actionContext, [NotNull] Type controllerType)
public virtual object Create([NotNull] ActionContext actionContext, [NotNull] Type controllerType)
{
var serviceProvider = actionContext.HttpContext.RequestServices;
return _typeActivatorCache.CreateInstance<object>(serviceProvider, controllerType);

View File

@ -38,8 +38,19 @@ namespace Microsoft.AspNet.Mvc
_getPropertiesToActivate = GetPropertiesToActivate;
}
/// <summary>
/// The <see cref="IControllerActivator"/> used to create a controller.
/// </summary>
protected IControllerActivator ControllerActivator
{
get
{
return _controllerActivator;
}
}
/// <inheritdoc />
public object CreateController([NotNull] ActionContext actionContext)
public virtual object CreateController([NotNull] ActionContext actionContext)
{
var actionDescriptor = actionContext.ActionDescriptor as ControllerActionDescriptor;
if (actionDescriptor == null)
@ -58,7 +69,7 @@ namespace Microsoft.AspNet.Mvc
}
/// <inheritdoc />
public void ReleaseController(object controller)
public virtual void ReleaseController(object controller)
{
var disposableController = controller as IDisposable;