<PackageReference Include="Castle.Windsor" Version="4.1.1" />

LazyServiceStrategy

using Castle.Core; using Castle.Core.Internal; using Castle.MicroKernel.Handlers; using System; using System.Linq; using System.Reflection; namespace Castle.MicroKernel.Internal { public class LazyServiceStrategy : IGenericServiceStrategy { public static readonly LazyServiceStrategy Instance = new LazyServiceStrategy(); private LazyServiceStrategy() { } public bool Supports(Type service, ComponentModel component) { return !service.GetTypeInfo().GetGenericArguments().Single() .IsPrimitiveTypeOrCollection(); } } }