Added non-generic registration interface to IKernel and IWindsor to accommodate dynam...
[castle.git] / MonoRail / Castle.MonoRail.Framework / IFilter.cs
blob2134f2f84f415d40eb921b67b298988c5d1eb7c8
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
19 /// <summary>
20 /// Enum (flag) to indicate when the filter should
21 /// or is invoked.
22 /// </summary>
23 [Flags]
24 public enum ExecuteEnum
26 /// <summary>
27 /// The filter is invoked before the action.
28 /// </summary>
29 [Obsolete("Use ExecuteEnum.BeforeAction")]
30 Before = BeforeAction,
31 /// <summary>
32 /// The filter is invoked after the action.
33 /// </summary>
34 [Obsolete("Use ExecuteEnum.AfterRendering or ExecuteEnum.AfterAction")]
35 After = AfterRendering,
36 /// <summary>
37 /// The filter is invoked before and after the action.
38 /// </summary>
39 [Obsolete("Use ExecuteEnum.Always or combine the ExecuteEnum values you want")]
40 Around = BeforeAction | AfterAction,
42 /// <summary>
43 /// The filter is invoked before the action.
44 /// </summary>
45 BeforeAction = 0x02,
46 /// <summary>
47 /// The filter is invoked after the action.
48 /// </summary>
49 AfterAction = 0x04,
50 /// <summary>
51 /// The filter is invoked after the rendering.
52 /// </summary>
53 AfterRendering = 0x08,
54 /// <summary>
55 /// The filter is invoked around all steps.
56 /// </summary>
57 Always = BeforeAction | AfterAction | AfterRendering
60 /// <summary>
61 /// Dictates the contract for filters. Implementors
62 /// should use filter to perform any logic before and/or
63 /// after the action invocation.
64 /// </summary>
65 public interface IFilter
67 /// <summary>
68 /// Implementors should perform they filter logic and
69 /// return <c>true</c> if the action should be processed.
70 /// </summary>
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>
75 /// <returns>
76 /// <c>true</c> if the action
77 /// should be invoked, otherwise <c>false</c>
78 /// </returns>
79 bool Perform(ExecuteEnum exec, IEngineContext context, IController controller, IControllerContext controllerContext);
82 /// <summary>
83 /// Dictates a contract that the defining
84 /// FilterAttribute can be set
85 /// </summary>
86 public interface IFilterAttributeAware
88 /// <summary>
89 /// Sets the filter.
90 /// </summary>
91 /// <value>The filter.</value>
92 FilterAttribute Filter { set; }