C#C
C#3y ago
Kiel

❔ Automatic discovery of scoped services without a marker interface

In the past, I had an IService interface which defined a (singleton at the time) service and a contract for certain service-level init functionality etc.
This was coupled with an extension method which used reflection to find all IService implementation types and register them with my service provider at startup.

I'm trying to do the same thing with scoped services, but I'm struggling to think of ANYTHING to put on this prospective IScopedService interface, and I always feel like marker interfaces are...smelly. Any suggestions? Or should I just ignore my gut feeling and be happy with a marker interface for this extremely specific usecase?
Was this page helpful?