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