I dug into the code and here is what I found. I don't believe
ReflectionBasedDictionaryAdapter it does exactly what it should, parse
an anonymous object to a dictionary. I believe
CommonUtils.BuildQueryString(IServerUtility, IDictionary, bool) is
where the problem lies. specifically lines 278-285, 305, 307.

right now the only check is whether the value is not a string &
enumerable (278) or anything else (282). it then encodes the value
(305) and uses the key as the querystring key (307).

It would seem this is where the modification is required.
determine if the value is a class object (reference object?) and build
the appropriate keys/values. However, how could we distinguish between
my class Sort and BCL classes like DateTime?


On Jun 3, 8:45 am, Jason Meckley <[email protected]> wrote:
> that's what I figured. If time permits I will attempt to patch it.
> Thanks for lead on ReflectionBasedDictionaryAdapter too.
>
> On Jun 2, 5:58 pm, John Simons <[email protected]> wrote:
>
> > Hi Jason,
>
> > Monorail doesn't currently support that, sorry!
> > We are using ReflectionBasedDictionaryAdapter (which you can find in 
> > Castle.Core.dll) to convert the anonymous type to a dictionary, maybe you 
> > want to have a look at it and provide us an enhancement patch for it?
>
> > Cheers
> > John
>
> > ________________________________
> > From: Jason Meckley <[email protected]>
> > To: Castle Project Users <[email protected]>
> > Sent: Thu, 3 June, 2010 2:23:47 AM
> > Subject: anonymous composite object
>
> > MR 2.0
> > .Net 3.5
>
> > I am attempting to redirect to an action using an anonymous object.
> > the problem is one of my parameters is a composite node. This
> > var sort = new Sort{By="Name", Ascending = true};
> > RedirectToAction("Index", new {page, term, sort});
> > produces the url
> > Index.castle?page=1&term=foo&sort=My.Namespace.Sort
>
> > which makes sense to some degree. however I want it to build the url
> > Index.castle?page=1&term=foo&sort.By=Name&sort.Ascending=true
>
> > currently I am building my parameters from a hashtable
> > var sort = new Sort{By="Name", Ascending=true};
> > var parameters = new Hashtable
> >     {
> >         {"page",page},
> >         {"term",term},
> >         {"sort.By",sort.By},
> >         {"sort.Ascending",sort.Ascending},
> >     };
> > RedirectToAction("Index", parameters);
>
> > Is it possible to build a url from a anonymous, composite object?
>
> > --
> > 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 
> > athttp://groups.google.com/group/castle-project-users?hl=en.
>
>

-- 
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