예제 #1
0
        public override void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope)
        {
            var registrar = registrationScope.Registrar(services);

            registrar(implementation, implementation);
        }
예제 #2
0
 public abstract void Register(IServiceCollection services, Type implementation, ServiceRegistrationScope registrationScope);
예제 #3
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);
            }
        }
        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);
        }