castle windsor学习----ComponentModel construction contributors

Posted 蓝平凡

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了castle windsor学习----ComponentModel construction contributors相关的知识,希望对你有一定的参考价值。

public class RequireLoggerProperties : IContributeComponentModelConstruction
{
    public void ProcessModel(IKernel kernel, ComponentModel model)
    {
        model.Properties
            .Where(p => p.Dependency.TargetType == typeof(ILogger))
            .All(p => p.Dependency.IsOptional = false);
    }
}
container.Kernel.ComponentModelBuilder.AddContributor(new RequireLoggerProperties());

 

以上是关于castle windsor学习----ComponentModel construction contributors的主要内容,如果未能解决你的问题,请参考以下文章

castle windsor学习-----Inline dependencies 依赖

Castle Windsor 学习-----Installer的几种安装方式

castle windsor学习-------Container Events 容器的事件

Castle.Windsor依赖注入的高级应用_Castle.Windsor.3.1.0

依赖注入 Castle.Windsor高级应用

Castle.Windsor依赖注入的高级应用