Hi,
I have an interesting problem. I have a whole bunch of components,
which are registered in my castle container. I mass-registered them
either based on a certain naming convention or on a common base-
interface they implement. This allows me to register all my components
with just two lines of code (kinda) using the fluent API.
So next I build my app using all those nice available components. So
each components specifies their needs as constructor-parameters. So
now I'm accessing only a handful of components directly in my app,
everything else is magically handled by castle.
OK, so now comes the catch. I have a component ConfigurationContext,
which needs an itemId parameter. This needs to be supplied by the app,
but the component is not resolved by the app, but by the dependencies
of other components.
So I would like to go ahead an tell castle "hey, is anyone needs the
itemId; it's 42!".
I though this must be achievable by using properties. I remembered
back when working with windsor.config.xml I could pass parameters to a
component while referencing a property. This was also specified in the
config-file, but hey, couldn't that be done via code as well? So this
is the real question: how would I do something like that? So how could
I tell the castle container that the value of a property called
"itemId" is 42?
And by the way: since I mass-registered all my components I would need
to adjust the ConfigurationContext component, so that castle know to
pull the "itemId" property as a paramter for this component. If I
would register this component individually I would do something like:
Container.Register(Component.For<IConfigurationContext>
().ImplementedBy<ConfigurationContext>().Parameters(Parameter.ForKey
("ItemId").Eq("{itemId}")));
So is there any way to "modify" an existing component-registration?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---