views:

42

answers:

1

What is the correct way to pass another component into Eq()?

_container.Register(
                 Component.For<IDocumentManagementServiceProvider>()
            .ImplementedBy<DocumentumServiceProvider>()
            .Parameters(Parameter.ForKey("credentials").Eq(?) // <---right here

Solution:

_container.Register(
                Component.For<IDocumentManagementServiceProvider>()
                    .ImplementedBy<DocumentumServiceProvider>()
                    .ServiceOverrides(
                        ServiceOverride.ForKey("credentials").Eq("documentum.repository.credentials"))
                    .DependsOn(Property.ForKey("numberOfTimesToRetryOperation").Eq(2))
                    .DependsOn(Property.ForKey("millisecondsBetweenRetries").Eq(1000))
                    .Named("document.management.service.provider"));
+1  A: 

Windsor will by default auto-wire the first component that is registered with the required interface. If you don't want this behavior, or want a specific component, you can use service overrides.

Also see the "Registering components" page of the Windsor wiki.

Mauricio Scheffer