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
18 /// Delegate to create dynamic actions without the need for a separated class.
20 /// <param name="controller">Controller instance</param>
21 public delegate void ActionDelegate(Controller controller
);
24 /// Represents a dynamic action that forwards the
25 /// call to an <see cref="ActionDelegate"/>
27 public class DelegateDynamicAction
: IDynamicAction
29 private readonly ActionDelegate actionDelegate
;
32 /// Initializes a new instance of the <see cref="DelegateDynamicAction"/> class.
34 /// <param name="actionDelegate">The action delegate.</param>
35 public DelegateDynamicAction(ActionDelegate actionDelegate
)
37 this.actionDelegate
= actionDelegate
;
41 /// Implementors should perform the action
42 /// upon this invocation
44 /// <param name="controller"></param>
45 public void Execute(Controller controller
)
47 actionDelegate(controller
);