I think if you specify just the component id/ no type/service and the
parameters for the component, and then call:
container.Install(Configuration.FromAppConfig(), // this has to go first
new YourInstallerFromCode()
);
if the IDs of the components registered in code match the ids from the
XML I think Windsor will pick the parameters from XML up.
Krzysztof
On 13/08/2010 7:03 PM, pmcg wrote:
John,
That one was one of the links i included and registered a
configuration component in the xml file, which could then be used by
the components which were registered using the fluent configuration
when those components are being resolved. I would rather not to use a
single configuration component for all these settings as they are not
related i.e. database connection string, max queue length, retry count
etc. Very often a dependant component will only depend on a single
property as a constructor parameter, so using properties from the
external configuration file as ideal.
I could create a number of configuration components where all related
settings are in the same components, but if there was a way to access
properties from the configuration file when doing the fluent
registration, i could avoid creating and registering any of these
configuration components
Pat
On Aug 12, 11:20 pm, John Simons<[email protected]> wrote:
Hi Pat,
This blog post should help
you:http://mikehadlow.blogspot.com/2010/02/10-advanced-windsor-tricks-9.html
Cheers,
John
________________________________
From: pmcg<[email protected]>
To: Castle Project Users<[email protected]>
Sent: Fri, 13 August, 2010 3:26:10 AM
Subject: Mixing external configuration with fluent registration
I'm trying to figure out how I can reference external configuration
properties (i.e. Database connection strings, log paths etc.), which
will be constructor parameters for components I am registering with
the fluent registration. When using xml configuration I would simply
have configured them as properties within the configuration file. When
configuring a component I would simply have configured the constructor
parameter using the #{propertyname} type syntax. I have tried this
with Depends and Parameters methods, but neither have worked.
Is it possible to use property values that have been defined within a
configuration file when the container was being created? Or are the
properties just available when constructing the container from the
configuration file?
I have seen examples where a configuration component is configured
within the configuration file and can then be passed as a constructor
parameter to other components that depend on the properties. This
requires one or more configuration types, which I would prefer not to
use. Would be nice to just inject the property values which are very
often distinct configuration items.
See these for examples of such configuration holding
typeshttp://mikehadlow.blogspot.com/2010/02/10-advanced-windsor-tricks-9.htmlhttp://ayende.com/Blog/archive/2008/12/31/didja-know-merging-windsor-...
I can always fall back on programmatically accessing properties from
the app settings section of my application configuration file when
doing my fluent registration, but if someone has managed to use
properties defined in the configuration file while registering the
components using the fluent registration I would appreciate any advice
Thanks in advance
Pat
--
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.