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

LifestyleDescriptor<S>

using Castle.Core; using Castle.Core.Configuration; using System.Collections.Specialized; namespace Castle.MicroKernel.Registration { public class LifestyleDescriptor<S> : ComponentDescriptor<S> { private readonly LifestyleType lifestyle; public LifestyleDescriptor(LifestyleType lifestyle) { this.lifestyle = lifestyle; } protected internal override void ApplyToConfiguration(IKernel kernel, IConfiguration configuration) { if (((NameValueCollection)configuration.get_Attributes())["lifestyle"] == null || base.IsOverWrite) { ((NameValueCollection)configuration.get_Attributes())["lifestyle"] = lifestyle.ToString(); ApplyLifestyleDetails(configuration); } } protected virtual void ApplyLifestyleDetails(IConfiguration configuration) { } } }