-
Notifications
You must be signed in to change notification settings - Fork 0
IServiceDiscovery
IServiceDiscovery is an interface used in the ServiceCollector framework for defining service registration logic. Implementations of this interface are automatically discovered and invoked to add services to the IServiceCollection.
namespace ServiceCollector.Abstractions
{
public interface IServiceDiscovery
{
void AddServices(IServiceCollection services);
}
}
The purpose of the IServiceDiscovery interface is to provide a standardized way to register services within an application. By implementing this interface, you can encapsulate the service registration logic and make it discoverable by the ServiceCollector lib.
void AddServices(IServiceCollection services);
This method is called by the ServiceCollector framework to register services. Implement this method to add your services to the provided IServiceCollection.
services: An instance of IServiceCollection where services should be registered.
Define a Service Discovery Class: Implement the IServiceDiscovery interface to define the services you want to register.
using Microsoft.Extensions.DependencyInjection;
using ServiceCollector.Abstractions;
public class MyServiceDiscovery : IServiceDiscovery
{
public void AddServices(IServiceCollection services)
{
// add your services ...
}
}