Fix for #384 - And some other changes to controller as filter
This is a major change to how we handle the scenario where a controller is a filter. We want to change the lifetime of the controller object, by scoping it around action filters and result filters. This means that a controller class can only implement action filters and result filters. To implement #384 - we're creating a delegating filter class 'ControllerFilter' which will forward calls to the implementation of the controller. This is discovered in the controller model and added to the filter collection. This filter is removable as an opt-out of this feature. The ControllerFilter only implements action filter and result filter, so the new restriction about filter types on Controller is in place. A future change will move the instantiation of the controller to after resource filters.
This commit is contained in:
parent
12c2759cec
commit
e1069dbf65
|
|
@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
return ActionContext?.RouteData;
|
return ActionContext?.RouteData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelStateDictionary ModelState
|
public ModelStateDictionary ModelState
|
||||||
{
|
{
|
||||||
|
|
@ -113,7 +113,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
return _viewData;
|
return _viewData;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
throw
|
throw
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue