1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
20 /// Enum (flag) to indicate when the filter should
24 public enum ExecuteEnum
27 /// The filter is invoked before the action.
29 [Obsolete("Use ExecuteEnum.BeforeAction")]
30 Before
= BeforeAction
,
32 /// The filter is invoked after the action.
34 [Obsolete("Use ExecuteEnum.AfterRendering or ExecuteEnum.AfterAction")]
35 After
= AfterRendering
,
37 /// The filter is invoked before and after the action.
39 [Obsolete("Use ExecuteEnum.Always or combine the ExecuteEnum values you want")]
40 Around
= BeforeAction
| AfterAction
,
43 /// The filter is invoked before the action.
47 /// The filter is invoked after the action.
51 /// The filter is invoked after the rendering.
53 AfterRendering
= 0x08,
55 /// The filter is invoked around all steps.
57 Always
= BeforeAction
| AfterAction
| AfterRendering
61 /// Dictates the contract for filters. Implementors
62 /// should use filter to perform any logic before and/or
63 /// after the action invocation.
65 public interface IFilter
68 /// Implementors should perform they filter logic and
69 /// return <c>true</c> if the action should be processed.
71 /// <param name="exec">When this filter is being invoked</param>
72 /// <param name="context">Current context</param>
73 /// <param name="controller">The controller instance</param>
74 /// <param name="controllerContext">The controller context.</param>
76 /// <c>true</c> if the action
77 /// should be invoked, otherwise <c>false</c>
79 bool Perform(ExecuteEnum exec
, IEngineContext context
, IController controller
, IControllerContext controllerContext
);
83 /// Dictates a contract that the defining
84 /// FilterAttribute can be set
86 public interface IFilterAttributeAware
91 /// <value>The filter.</value>
92 FilterAttribute Filter { set; }