views:

48

answers:

1

I find one of the best features of Ninject is conventions-based binding. eg.

Bind<IConfigurationSource>().To<RemoteConfigurationSource>()
.Only(When.Context.Target.Name.BeginsWith("remote"));

Bind<IConfigurationSource>().To<LocalConfigurationSource>()
.Only(When.Context.Target.Name.BeginsWith("local"));

http://ninject.codeplex.com/Wiki/View.aspx?title=Conventions-Based%20Binding&amp;referringTitle=Home

Is this possible in StructureMap 2.5.3?

Thanks

A: 

StructureMap has various ways of dynamically determining which concrete type to return based on a request (TheDefault.Is.ConstructedBy, TheDefault.Is.Conditional, etc).

However, (as of 2.5) none of them have access to the parameter name that is being filled, as in your example.

Joshua Flanagan