This has completely baffled me on a number of configurations. I keep reading the documentation, and I just don't get it. Here is my registration code:
ForRequestedType<SimpleWorkItemProcessor>().TheDefault.Is.OfConcreteType<SimpleWorkItemProcessor>();
ForRequestedType<WorkItemRetryProcessor>().TheDefault.Is.OfConcreteType<WorkItemRetryProcessor>()
.CtorDependency<IWorkItemProcessor>().Is(x => x.OfConcreteType<SimpleWorkItemProcessor>())
.WithCtorArg("busyDelay").EqualTo(TimeSpan.FromMilliseconds(20))
.WithCtorArg("overallTimeout").EqualTo(TimeSpan.FromSeconds(60));
ForRequestedType<WorkItemQueue>().TheDefault.Is.OfConcreteType<WorkItemQueue>()
.CtorDependency<IWorkItemProcessor>().Is(x => x.OfConcreteType<WorkItemRetryProcessor>());
As it is, it says there's no default instance for IWorkItemProcessor (which is correct). Switching the last line to this:
ForRequestedType<IWorkItemProcessor>().TheDefault.Is.OfConcreteType<WorkItemQueue>()
.CtorDependency<IWorkItemProcessor>().Is(x => x.OfConcreteType<WorkItemRetryProcessor>());
...Makes a stack overflow exception.
How do you chain classes together that both implement an interface, and take in that same interface in their constructor?