public static IRegistration CreateWindsorRegistration(this Microsoft.Extensions.DependencyInjection.ServiceDescriptor service)
 {
     if (service.ServiceType.ContainsGenericParameters)
     {
         return(RegistrationAdapter.FromOpenGenericServiceDescriptor(service));
     }
     else
     {
         var method = typeof(RegistrationAdapter).GetMethod("FromServiceDescriptor", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(service.ServiceType);
         return(method.Invoke(null, new object[] { service }) as IRegistration);
     }
 }
Exemple #2
0
        public object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
        {
            var factory = _kernel.Resolve <ILoggerFactory>();

            return(factory.CreateLogger(RegistrationAdapter.OriginalComponentName(model.Name)));
        }