khellang / Scrutor

Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection
MIT License
3.63k stars 239 forks source link

Question: How to scan for this #149

Open jakenuts opened 3 years ago

jakenuts commented 3 years ago

Apologies that this isn't a bug, not sure where to best ask the question and will try here and S.O.

I need to scan & register services that are constrained generics starting with a contrained-generic parameter of their parent class. I'm now sure how I got this absurdly complicated setup in the first place, but hoping to replicate what seems relatively easy in Autofac with IServiceCollection/Scrutor.

Here is the absurdly complex model:

image

And the pseudo-attempt to register them. I can't determine how to go from the open parent type to a semi-open parent type constrained to the passed in context type.

image

Thanks so much!

jakenuts commented 3 years ago

Got a bit closer with a Where..

image