I have an extension method that registers some services :
endpoints.MapService<MyService>();
Behind the scenes the extension method looks like:
public static void MapService<TService>(this IEndpointRouteBuilder builder) where TService : class
Now I don't have the actual classes to configure at runtime but I do have the Type of the class which is typeof(MyService)
, how can I use that to register my service using the extension method MapService
?
I am guessing some methods in the reflection namespace could help me with that.