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);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        public override void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope)
        {
            var registrar = registrationScope.Registrar(services);

            registrar(implementation, implementation);
        }