Unity's InjectionConstructor
works well when you need to invoke a specific constructor because you have very specific dependencies in mind (e.g. any mix of external dependencies, named registrations, or unnamed registrations), but it requires all parameters to be specified.
Is there some way to augment Unity's "find and use the constructor with the most number of parameters" with "find and use the constructor with the most number of parameters that also could accept an instance of IX
somewhere in the signature"?
Mark's comment provided the basis for the answer. Namely, the implementation of AddPolicies
InjectionConstructor
. There are limitations (e.g. if the values are null or they get matched against a supertype in a constructor), andI'm not saying this is good though. I ultimately used RegisterInstance
elsewhere and the mixed-parameter need went away. But it's a solution for those who might need it.