I have an Autofac container and I would like to be able to retrieve all the registered service types (not the implementation types, but the types they are registered as).
How can I get this information from an IComponentContext
?
You can use this:
var services =
context.ComponentRegistry.Registrations.SelectMany(x => x.Services)
.OfType<IServiceWithType>()
.Select(x => x.ServiceType);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With