I want to redefine an (default) implementation in a given windsor-container. Is that what OverWrite is for? Doesn’t work, though.
container.Register(
Component.For<IServiceOperationAuthorization>()
.OverWrite()
.Instance(_authorization)
);
Any other Ideas?
cheers,
Lars
I actually found a nice solution where I combine xml-files for overrides and use fluent registrations for defaults.
The fluent-API takes the fullname of a impl as the default key. On the fly I override the id’s of the xml-config to imitate the key-conventions of the fluent-API.
Then i register the xml-config while I listen to
Kernel.ComponentRegistered.Afterwards I only add services from the code-config where the xml hasn’t yet defined the service.
(it’s a while ago and I just copy-pasted the code. hopefully you get it working. I’ll do edits if you find any problems)
After that before I register services in code, I check if they already have been registered. I also created a base class that makes this more easy. This is an application configuration:
The base class that does the wiring:
(Logging is from Commons.Logging)