StopConcern
using Castle.Core;
using System.Reflection;
namespace Castle.Facilities.Startable
{
public class StopConcern : IDecommissionConcern, ILifecycleConcern
{
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) {
MethodInfo methodInfo = model.ExtendedProperties["Castle.StartableFacility.StopMethod"] as MethodInfo;
if (methodInfo != (MethodInfo)null)
methodInfo.Invoke(component, null);
}
}
}
}