I have a class that currently takes an IIndex
in order to select an indexed dependency. I'd like to change that to somehow using an attribute on the constructor argument, in order to directly specify which one to use.
I'm pretty sure Autofac doesn't support this natively, but I'm not afraid to write my own attribute for this. I've messed around with the source side of Autofac before (custom registration sources, etc.) but I've never seen a way of tailoring the injection side. Can anyone help?
P.S.: I've seen this question but it turned into a discussion on the benefits of attribute-based injection. OTOH, I already decided I don't want to have to manually register each one of my types that depends on this particular dependency one-by-one, so I'd prefer it.
IIndex
is currently used, and some pseudo-code of how you would like it to become?