MixinInspector
using Castle.Core;
using Castle.Core.Configuration;
using Castle.MicroKernel.Proxy;
using Castle.MicroKernel.Util;
using System;
using System.Collections.Generic;
namespace Castle.MicroKernel.ModelBuilder.Inspectors
{
[Serializable]
public class MixinInspector : IContributeComponentModelConstruction
{
public void ProcessModel(IKernel kernel, ComponentModel model)
{
if ((object)model.Configuration != null) {
IConfiguration val = model.Configuration.get_Children().get_Item("mixins");
if (val != null) {
List<ComponentReference<object>> list = new List<ComponentReference<object>>();
foreach (IConfiguration item in (List<IConfiguration>)val.get_Children()) {
string value = item.get_Value();
string text = ReferenceExpressionUtil.ExtractComponentName(value);
if (text == null)
throw new Exception($"""{value}""");
list.Add(new ComponentReference<object>(text));
}
if (list.Count != 0) {
ProxyOptions object = model.ObtainProxyOptions(true);
list.ForEach(object.AddMixinReference);
}
}
}
}
}
}