相关疑难解决方法(0)

Log ninject已解决的依赖项应用程序启动

我们已经开始使用Ninject版本2作为我们的Io​​C容器以及通过命名约定解析的扩展.我们还使用log4net进行日志记录.

我想要的是让Ninject记录它找到的所有依赖项以及将它们解决的依赖项,最好是在应用程序启动时.

我找到了日志记录扩展,但找不到有关如何使用它来获取此文档或示例.

编辑:

因为这里请求的是使用log4net在启动时记录默认绑定的类

public class DefaultBindingGeneratorWithLogging:IBindingGenerator {private readonly IKernel kernel;

    /// <summary>
    /// Initializes a new instance of the <see cref="DefaultBindingGeneratorWithLogging"/> class.
    /// </summary>
    /// <param name="kernel">The kernel.</param>
    public DefaultBindingGeneratorWithLogging(IKernel kernel)
    {
        this.kernel = kernel;
    }

    /// <summary>
    /// Creates the bindings for a type.
    /// </summary>
    /// <param name="type">The type for which the bindings are created.</param>
    /// <param name="bindingRoot">The binding root that is used to create the bindings.</param>
    /// <returns>
    /// The syntaxes for the created bindings …
Run Code Online (Sandbox Code Playgroud)

.net c# log4net ninject

6
推荐指数
1
解决办法
3099
查看次数

标签 统计

.net ×1

c# ×1

log4net ×1

ninject ×1