Remo and I first discussed passing null or default(t). But this is also a valid case for constants passing into the ctor. Therefore we need to differentiate this case. The let construct or a similar construct gives us the possibility to either define constants, null, defauls or let ninject inject the dependency. What also would be possible with this approach the let the user define stuff like
.Bind<Foo>().ToSelf().UsingCtor(() => new X(3, Let.Inject<IBar>(), MagicValueRetrievalMethodWithArgument(blub))
We did spike this approach yesterday and it worked like a charm
Daniel
> --
> You received this message because you are subscribed to the Google Groups "ninject" group.
> To post to this group, send email to nin...@googlegroups.com.
> To unsubscribe from this group, send email to ninject+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ninject?hl=en.
>
The problem with this approach is in my opinion that the user of the API
needs to know whether to use Many, ArrayOf etc. With one generic Let the
user only needs to define the generic of the specific ctor argument
therefore instead of:
> .UsingCtor( get => new HavingSingleDependency(get.One<IBar>())
> .UsingCtor( get => new HavingEnumerableDependency(get.Many<IBar>())
> .UsingCtor( get => new HavingArrayOfDependencies(get.ArrayOf<IBar>())
He would do:
> .UsingCtor( get => new HavingSingleDependency(Let.Inject<IBar>())
> .UsingCtor( get => new
HavingEnumerableDependency(Let.Inject<IEnumerable<IBar>>())
> .UsingCtor( get => new
HavingArrayOfDependencies(Let.Inject<Array<IBar>>())
Daniel