With out-of-the-box Autofac it is expected that every type you want to use is registered with the container, either directly using the Register...
methods or in bulk using RegisterAssemblyTypes
. But there are other options too, take a look at Nicholas article about resolving everything. So yes, Autofac can do what Unity does, but you'll have to enable it.
Update: actually, the "resolve anything" feature is built-in now, and you can do the following:
var cb = new ContainerBuilder();
cb.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
return cb.Build();
With the AnyConcreteTypeNotAlreadyRegisteredSource
you can actually resolve both C
and B
without registering any of them.
Note: guess this topic over at the Autofac discussion group is related.