The ViewComponentParamAttribute has a DefaultValue option, which is
handled in ViewComponent.BindParameter() for comparison.

On Tue, Aug 11, 2009 at 6:42 AM, Daniel Hölbling<[email protected]> wrote:
> Hmm.. That's a good Question.
> Actually it will result in a MonoRailException. Only "improvement" could be
> to make it throw a FormatException so that MonoRail outputs a nicer
> errormessage. But I believe failing fast is best here.
> Now what made me wonder a bit is how to test this thing. I'm trying to come
> up with a testcase to verify that a Exception was thrown, but I have no idea
> how to invoke the IParameterBinder stuff within the DispatcherController
> without simply copy/pasting the code from the BuildMethodParameters.
> Everything else would involve subclassing the SmartDispatcherController with
> my testmethod and that would then rob me of the ability to use the
> TestSupport baseclass from MonoRail.
> Any suggestions?
>
> On Fri, Aug 7, 2009 at 2:46 PM, Roelof Blom <[email protected]> wrote:
>>
>> Looks OK to me. What about assigned a default value that cannot be
>> converted, i.e.
>> public void Browse([DefaultValue("one")] int page)
>>
>> On Mon, Aug 3, 2009 at 2:26 PM, Daniel Hölbling <[email protected]>
>> wrote:
>>>
>>> Hi,
>>> While reading through ScottGu's announcement of MVC 2 Preview 1 I found
>>> this new feature interesting:
>>>>
>>>> public void Browse([DefaultValue(1)] int page)
>>>>
>>>> {
>>>>
>>>>
>>>>
>>>> }
>>>
>>> After reading Ken Egozi's blogpost about writing a custom parameter
>>> binder
>>> (http://www.kenegozi.com/blog/2008/09/15/creating-a-custom-parameter-binder-for-monorail-actions-iparameterbinder.aspx) I
>>> figured it shouldn't be that hard to implement this for MonoRail too (as far
>>> as I could see MR has no such thing right now except for defaults through
>>> routing).
>>> So I did adapt his sample to allow for the exact same syntax as in MVC 2.
>>> I'd like to hear your comments on the code.
>>> greetings Daniel
>>> http://www.tigraine.at
>>>
>>>
>>
>>
>>
>
>
> >
>



-- 
Truth,
    James

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to