Ok, now I remember again why I'm using parameters...

My map declaration on my component class looks like:

public Dictionary<string, Converter<string, string>> Map


Now, using:

bar = someVariableOrCallable
component MyObject:
  Map = {"foo": bar}


Yields "Object of type 'Boo.Lang.Hash' cannot be converted to type
'System.Collections.Generic.Dictionary`2
[System.String,System.Converter`2[System.String,System.String]]'"


So I started to use the KeyMapBuilder for this, bumping into the
aforementioned problems.


On Apr 23, 4:21 pm, Craig Neuwirt <[email protected]> wrote:
> On Thu, Apr 23, 2009 at 9:16 AM, Grimace of Despair <
>
> [email protected]> wrote:
>
> > I've actually got a kind of deamon which loads Binsor applications
> > like aspnet_wp would load ASP.NET applications (though not nearly as
> > advanced). This setup allows me writing (copmiled) class libraries
> > that do the nitpicking, while being able to throw them around within
> > different configuration settings. Just to say that the running code is
> > actually container-agnostic, and stuff like custom dependencies would
> > have to be taken care of by my daemon.
>
> Sounds nifty
>
>
>
> > Now for the custom dependencies: I guess that can't be done in Binsor,
> > or am I missing something?
>
> You can, something like this
>
> component x:
> ____Map = { 'foo': MyObject() }
>
> This cuts out the whole conversion thing which is totally not needed in
> Binsor world
>
>
>
> > On Apr 23, 2:49 pm, Craig Neuwirt <[email protected]> wrote:
> > > Not sure if this helps, but the parameters and configuration sections in
> > > binsor are used to expose the corresponding configuration model supported
> > in
> > > MK.  I don't believe custom conversions are handled for the values.
> > >  However, when using Binsor, I generally only use those sections for
> > > Facility configurations that are already based on configuration.
> >  Otherwise,
> > > I just set the dependencies directly.  These could be anything and just
> > get
> > > added to the custom dependencies collection and bound directly at
> > resolution
> > > time
> > > craig
>
> > > On Thu, Apr 23, 2009 at 7:22 AM, Grimace of Despair <
>
> > > [email protected]> wrote:
>
> > > > The following string to string mapping works fine for me:
>
> > > > component x:
> > > > _parameters:
> > > > __Map:
> > > > ___map(keymap) = {
> > > > ____"foo": "bar"
> > > > ___}
>
> > > > A string to component map also does:
>
> > > > component bar
> > > > component x:
> > > > _parameters:
> > > > __Map:
> > > > ___map(keymap) = {
> > > > ____"foo": @bar
> > > > ___}
>
> > > > Now I'm trying to pass in a custom, non-primitive object:
> > > > component x:
> > > > _parameters:
> > > > __Map:
> > > > ___map(keymap) = {
> > > > ____"foo": MyObject()
> > > > ___}
>
> > > > This fails with:
>
> > > > Castle.MicroKernel.SubSystems.Conversion.ConverterException: No
> > > > converter registered to handle the type MyObject.
>
> > > > I've done a little digging, and there are two remarks I have:
>
> > > > 1. KeyMapBuilder relies on ConfigurationHelper.SetConfigurationValue,
> > > > which converts MyObject to a string, losing any reference to the
> > > > actual object. Most probably, there's a really logical explanation for
> > > > this scenario, but to me, it seems that the map gets severely limited
> > > > by the use of the said SetConfigurationValue.
>
> > > > 2. Even if the value was not converted to a string, the
> > > > GenericDictionaryConverter might not be able to use the original
> > > > value, because it does a PerformConversion. Afaics (but I might be
> > > > wrong), this method won't handle the conversion because no converter
> > > > exist, while the value would already be of the correct type.
>
> > > > Could it be that I'm trying to push things? I can imagine the
> > > > ConfigurationHelper uses string conversions for a reason, but the
> > > > inability to use custom objects in the map ... well... it sucks :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" 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/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to