© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
Kiel

❔ Automatic discovery of scoped services without a marker interface

In the past, I had an
IService
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
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
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ IServiceProvider, scoped services, scopes
C#CC# / help
3y ago
✅ Scoped-based logging: Microsoft interface
C#CC# / help
3y ago
✅ ASP.NET Core DI: DbContext Not Shared in Scoped Services
C#CC# / help
7mo ago
❔ Make interface deriving from another interface have a sealed implementation of a function
C#CC# / help
3y ago