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

StopConcern

using Castle.Core; using System.Reflection; namespace Castle.Facilities.Startable { public class StopConcern : IDecommissionConcern { private static readonly StopConcern instance = new StopConcern(); public static StopConcern Instance => instance; protected StopConcern() { } public void Apply(ComponentModel model, object component) { if (component is IStartable) (component as IStartable).Stop(); else if ((object)model.Configuration != null) { (model.ExtendedProperties["Castle.StartableFacility.StopMethod"] as MethodInfo)?.Invoke(component, null); } } } }