Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / MonoRail / Castle.MonoRail.ActiveRecordSupport / ARSmartDispatcherController.cs
blob3b26ae19742d38d09d94b77fa23ee635232e4a59
1 // Copyright 2004-2008 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.ActiveRecordSupport
17 using System;
18 using Castle.MonoRail.Framework;
20 /// <summary>
21 /// Extends the <see cref="SmartDispatcherController"/>
22 /// with ActiveRecord specific functionality
23 /// </summary>
24 public class ARSmartDispatcherController : SmartDispatcherController
26 /// <summary>
27 /// Initializes a new instance of the <see cref="ARSmartDispatcherController"/> class.
28 /// </summary>
29 public ARSmartDispatcherController() : base(new ARDataBinder())
33 /// <summary>
34 /// Binds the object using the posted values.
35 /// </summary>
36 /// <param name="from">Defines where the parameters should be obtained from.</param>
37 /// <param name="targetType">Type of the target.</param>
38 /// <param name="prefix">The prefix.</param>
39 /// <param name="excludedProperties">The excluded properties.</param>
40 /// <param name="allowedProperties">The allowed properties.</param>
41 /// <param name="autoLoad">The auto load behavior.</param>
42 /// <returns></returns>
43 protected object BindObject(ParamStore from, Type targetType, String prefix, String excludedProperties, String allowedProperties, AutoLoadBehavior autoLoad)
45 SetAutoLoadBehavior(autoLoad);
47 return BindObject(from, targetType, prefix, excludedProperties, allowedProperties);
50 /// <summary>
51 /// Binds the object.
52 /// </summary>
53 /// <param name="from">Defines where the parameters should be obtained from.</param>
54 /// <param name="targetType">Type of the target.</param>
55 /// <param name="prefix">The prefix.</param>
56 /// <param name="autoLoad">The auto load behavior.</param>
57 /// <returns></returns>
58 protected object BindObject(ParamStore from, Type targetType, String prefix, AutoLoadBehavior autoLoad)
60 SetAutoLoadBehavior(autoLoad);
61 return BindObject(from, targetType, prefix);
64 protected void BindObjectInstance(object instance, ParamStore from, String prefix, AutoLoadBehavior autoLoad)
66 SetAutoLoadBehavior(autoLoad);
67 BindObjectInstance(instance, from, prefix);
70 protected void BindObjectInstance(object instance, String prefix, AutoLoadBehavior autoLoad)
72 SetAutoLoadBehavior(autoLoad);
73 BindObjectInstance(instance, ParamStore.Params, prefix);
76 protected void SetAutoLoadBehavior(AutoLoadBehavior autoLoad)
78 ARDataBinder binder = (ARDataBinder) Binder;
79 binder.AutoLoad = autoLoad;