Windsor v3
Here we collect and vote for ideas for next major version of Castle Windsor IoC container
-
Add convention over configuration features to IoC containers
NInject and StructureMap both have contextual dependency injection, and Hiro is going to be mostly conventions based.
It'd be nice if MicroKernel and Windsor supported more conventions-based approach, possibly something similar to what I outlined here: http://kozmic.pl/archive/2009/04/09/convention-based-dependency-injection-with-castle-microkernelwindsor.aspx108 votesWhat exactly would you like to see: what features, what syntax, what conventions…
-
Add ability to override configuration in XML
The Binsor DSL has the extremely useful Extend macro, but it achieves this by replicating the ComponentModel data model, which isn't ideal.
So, the proposal is that we allow something along the lines of:
container.Register(
ExtendComponent.For<IService>.Parameters( <<so on and so on>>
)Now, this is relatively simple to achieve if you can buffer the component registrations (in that ExtendComponent<For>.Component could return the original ComponentRegistration), but of course that would require a separate "process registrations step". A helper object might be needed.
The benefits should be relatively obvious. You could have your principal configuration done fluently within the code, with the…
25 votesThis is gonna be pretty work consuming, postponed for vNext. We accept patches.
-
Provide more compact, discoverable fluent API
some people find current fluent API too verbose and hard to discover:
- connect that for method that takes params IRegistration[] you have to use either Component. or AllTypes.Perhaps a default implementation of IWindsorInstaller that exposes protected methods working with nested closures to be more discoverable, would be a good addition
16 votesThis will be part of v3. Tangible ideas, preferably in form of runnable proof-of-concept implementations welcome.
-
Inject members to existing instance
InjectMembers(instance) - resolve dependencies on an existing instance without registering the type in the container. That would be useful for situations where the instance is created by someone else (like the Page instance in ASP.Net WebForms).
13 votes -
Expose container-wide defaults for things like Lifestyle
- Global settings - make it nicer to:
- Default Lifestyle setting
- Default disposable tracking setting12 votesThis might be a good idea to provide it in v3
-
take greater advantage of the container, when extending the container itself
Do not use special extension points for anything other than Facilities
and Subsystems.
For things like IModelInterceptorSelectors, etc just have them
registered into the container
and resolve them as needed, much like ILazyComponentLoaders are handled.11 votes -
A registry class entry point
Here is a sample: http://geekswithblogs.net/wesm/archive/2010/02/25/sexy-windsor-registrations.aspx
Basically like StructureMap's registry class and FluentNHibernate's mapping classes.
8 votesThis is one of things I have in mind for vNext. We accept patches.
-
[Windsor] Support interception for services created UsingFactoryMethod
It would be interesting if Windsor could support the interception of calls made to services created via the 'UsingFactoryMethod' syntax:
container.Register(Component.For<ISomeService>().UsingFactoryMethod(()
=> new
SomeServiceImpl(5)).Interceptors(InterceptorReference.ForType<SomeServiceIn terceptor>()).First);Currently, this will generate the following exception when any member of the resolved service is called:
System.NotImplementedException: This is a DynamicProxy2 error: the
interceptor attempted to 'Proceed' for method 'Int32
DoSomething(Int32)' which has no target. When calling method without
target there is no implementation to 'proceed' to and it is the
responsibility of the interceptor to mimic the implementation (set
return value, out arguments etc)6 votessounds reasonable
-
6 votes
Generally what this means is something like in this post: http://igorbrejc.net/development/c/windsor-castle-auto-wiring-using-parameter-names
-
support only Singleton/Transient
All other lifetimes can be derived from these two with child containers.
Also, supporting only these two fix the invalid situations where lifestyles are incompatible
5 votes -
[Windsor] UsingFactoryMethod should be merged to Component.For<T>(factory)
UsingFactoryMethod method from Fluent API should be made into overload of For<> so that
Component
.For<IFoo>()
.UsingFactoryMethod(kernel => kernel.Resolve<IFooFactory>().CreateFoo())becomes
Component
.For<IFoo>(kernel => kernel.Resolve<IFooFactory>().CreateFoo())This feels more natural, is consistent with other frameworks, and limits the number of methods on the fluent API which improves discoverability
5 votes -
Add proxy support for the DLR.
Allow passing an interface and a Dynamic Object, then generate a proxy which delegates to the dynamic.
Would be very useful for interoperating with DLR languages / Duck typing.
4 votes -
Enforce 3-calls pattern by requiring just one call to Install and making container immutable after
Currently the API does not guide users towards "correct" usage. It might be beneficial to re-design it so that it's much more explicit as to what should happen when.
It could do what some other containers do - explicitly split into two phases - registration and usage (like ContainerBuilder -> Container).4 votes -
Integrate strongly typed property wiring with fluent registration API
Make http://using.castleproject.org/display/IoC/Strongly+Typed+property+wiring+with+Fluent+Registration+API part of the core Windsor code.
The startable facility registration already has some Expression<Func<?>> stuff, so why not apply this to any registration.3 votes -
Generate proxies to match up lifestyles of components that have different lifestyles
- Generate proxies to match up lifestyles of components that have different life styles.
- So if I am singleton and depends on request scope stuff, I get a proxy that match that up.3 votesI’m not sure that this is the best solution. We should certainly somehow address that. We need to detect the scenario and perhaps take advantage of proxies as one possible solution, but I’d be against doing this implicitly by default
-
Create a registration-only interface
Create an interface, implemented by the container, that only allows registration. This way, I could restrict the use of the service locator pattern without restricting the ability to actually register components.
3 votes -
2 votes
-
smaller footprint
smaller assembly means smaller memory requirements. think of WP7 scenarios
1 vote -
Resolution of generic types should be driven by generic constraints
Given a generic interface IM<> and two implementations M1<T> where T : ISomeInterface and M2<T>. When we have a class A1 : ISomeInterface and we resolve IM<A1> it should return M1<>, rather than M2<>. When we have a class A2 that does not implement ISomeInterface Resolve<IM<A2>> should return M2<>. Here's a worked example: http://gist.github.com/622123
1 vote -
Remove ability to register components via XML
Ability to register components in XML is mostly a leftover from early days of Windsor before Fluent Registration API was created. It is much less powerful than registration in code and many tasks can be only accomplished from code.
So why keep on supporting an old and outdated registration mechanism.1 vote
- Don't see your idea?