Activation behavior modification made easier
- Made Activate method virtual - Changed IReadOnlyDictionary to IDictionary
This commit is contained in:
parent
9ac37fbc7a
commit
a5a3eb44b9
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public class DefaultControllerActivator : IControllerActivator
|
||||
{
|
||||
private readonly Func<Type, PropertyActivator<ActionContext>[]> _getPropertiesToActivate;
|
||||
private readonly IReadOnlyDictionary<Type, Func<ActionContext, object>> _valueAccessorLookup;
|
||||
private readonly IDictionary<Type, Func<ActionContext, object>> _valueAccessorLookup;
|
||||
private readonly ConcurrentDictionary<Type, PropertyActivator<ActionContext>[]> _injectActions;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -39,7 +39,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
/// <param name="controller">The controller to activate.</param>
|
||||
/// <param name="context">The context of the executing action.</param>
|
||||
public void Activate([NotNull] object controller, [NotNull] ActionContext context)
|
||||
public virtual void Activate([NotNull] object controller, [NotNull] ActionContext context)
|
||||
{
|
||||
var controllerType = controller.GetType();
|
||||
var controllerTypeInfo = controllerType.GetTypeInfo();
|
||||
|
|
@ -58,7 +58,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual IReadOnlyDictionary<Type, Func<ActionContext, object>> CreateValueAccessorLookup()
|
||||
protected virtual IDictionary<Type, Func<ActionContext, object>> CreateValueAccessorLookup()
|
||||
{
|
||||
var dictionary = new Dictionary<Type, Func<ActionContext, object>>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public class DefaultViewComponentActivator : IViewComponentActivator
|
||||
{
|
||||
private readonly Func<Type, PropertyActivator<ViewContext>[]> _getPropertiesToActivate;
|
||||
private readonly IReadOnlyDictionary<Type, Func<ViewContext, object>> _valueAccessorLookup;
|
||||
private readonly IDictionary<Type, Func<ViewContext, object>> _valueAccessorLookup;
|
||||
private readonly ConcurrentDictionary<Type, PropertyActivator<ViewContext>[]> _injectActions;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Activate([NotNull] object viewComponent, [NotNull] ViewContext context)
|
||||
public virtual void Activate([NotNull] object viewComponent, [NotNull] ViewContext context)
|
||||
{
|
||||
var propertiesToActivate = _injectActions.GetOrAdd(viewComponent.GetType(),
|
||||
_getPropertiesToActivate);
|
||||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// Creates a lookup dictionary for the values to be activated.
|
||||
/// </summary>
|
||||
/// <returns>Returns a readonly dictionary of the values corresponding to the types.</returns>
|
||||
protected virtual IReadOnlyDictionary<Type, Func<ViewContext, object>> CreateValueAccessorLookup()
|
||||
protected virtual IDictionary<Type, Func<ViewContext, object>> CreateValueAccessorLookup()
|
||||
{
|
||||
return new Dictionary<Type, Func<ViewContext, object>>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue