public override void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope) { var firstInterface = implementation.GetInterfaces().FirstOrDefault(); if (firstInterface == null) { throw new ArgumentException($"{implementation.Name} does not have any interfaces"); } var registrar = registrationScope.Registrar(services); registrar(firstInterface, implementation); }
public override void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope) { var interfaces = implementation.GetInterfaces(); if (!interfaces.Any()) { throw new ArgumentException($"{implementation.Name} does not have any interfaces"); } var registrar = registrationScope.Registrar(services); foreach (var @interface in interfaces) { registrar(@interface, implementation); } }
public override void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope) { var registrar = registrationScope.Registrar(services); registrar(implementation, implementation); }