Sure thing.  It's a bit of a contrived example, but here goes:

I want to have some properties registered in my <castle> section in my
web.config:

  <configSections>
    <section name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,
Castle.Windsor"/>
  </configSections>

  <castle>
    <properties>
      <password_property>SomePassword<password_property>
    </properties>
  </castle>


And then use them when registering a component fluently:

windsorContainer = new WindsorContainer();
windsorContainer.Install(Configuration.FromAppConfig());

windsorContainer.Register(
Component
.For<SomeComponent>()
 .Parameters(Parameter.ForKey("password").Eq("#{password_property}"))
);

Could be I'm doing it all wrong, but what I get passed into the "password"
parameter in the constructor of my SomeComponent instance is the value
"#{password_property}" rather than "SomePassword" as I sexpected.

What am I doing wrong?

Cheers,

Symon.

Symon Rottem
http://blog.symbiotic-development.com


On Fri, Oct 15, 2010 at 7:20 PM, Jason Meckley <[email protected]>wrote:

> yes you can, there are multiple ways to configure components. first
> get the values from the xml file. that is external to windsor. then
> you can use the DependsOn fluent method or ServiceOverride or
> Property.For().Eq() to configure the component. there may be more
> options as well but these are ones I'm aware of.
>
> if you provide a code sample of what you want to do we may be able to
> help.
>
> On Oct 15, 12:56 pm, João Bragança <[email protected]> wrote:
> > It's an ugly solution, but what about loading the XML file in an
> > xmldocument/xdocument and getting the properties that way?
> >
> > On Oct 15, 7:15 am, Symon Rottem <[email protected]> wrote:
> >
> > > Is it possible to use property reference notation (#{property}) in the
> > > fluent API?
> >
> > > I want to use properties that are registered in XML to set values on
> > > components registered via the API, but I don't seem to be having any
> luck.
> >
> > > Cheers,
> >
> > > Symon.
> >
> > > Symon Rottemhttp://blog.symbiotic-development.com
> >
> >
>
> --
> 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]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://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