views:

587

answers:

1

Hi,

I am just getting started with the Fluent registration for Castle Windsor and cant figure out how I can reference properties I have defined in the properties section of my XML configuration file when registering. So I have this code to register a component.

RegisterComponent(componentId, Component.For<ConnectionConfig>()
            .ImplementedBy(typeof(ConnectionConfig))
            .Named(componentId)
            .LifeStyle.Singleton
            .Parameters(
                Parameter.ForKey("ConnectionId").Eq(connectionId),
                Parameter.ForKey("CommandTimeoutSeconds").Eq("#{ConnectionInfo.DefaultTimeout}")));

The #{ConnectionInfo.DefaultTimeout} is a property I have defined in the XML config which is loaded into the container prior to the Fluent registrations, but this does not work, in this code the parameter passed to Eq() is treated as a literal (although this works for other components i.e. ${My.Component} would work)

Any ideas how I can reference properties from my configuration file while registering components through the new Fluent API?

Thanks

+1  A: 

Please create a testcase and submit it to the issue tracker.

As a workaround, the Configure() method should work, as it mimics the xml config more closely. See this for reference.

Mauricio Scheffer