Log4net Repository 模块
一。
Repository 的意思是储存库,并且根据之前的分析,显然Repository模块 维护着系统中定义的ILogger,以及和Name,Assamble的对应关系,和Appender 的对应关系,那么现在要分析的就是:
- 如何实现命名实体。
- 如何支持实体查询。
- 实体查询是不是就是依赖查询呢?
二。
1.Hierarchy
在使用DefaultRepositorySelector创建ILoggerRepository时默认使用的LoggerRepository为Hierarchy ,
而Hierarchy结构:
Hierarchical organization of loggers
/// This class is specialized in retrieving loggers by name and
/// also maintaining the logger hierarchy. Implements the
/// <see cref="ILoggerRepository"/> interface.
/// </para>
/// <para>
/// The structure of the logger hierarchy is maintained by the
/// <see cref="GetLogger(string)"/> method. The hierarchy is such that children
/// link to their parent but parents do not have any references to their
/// children. Moreover, loggers can be instantiated in any order, in
/// particular descendant before ancestor.
/// </para>
/// <para>
/// In case a descendant is created before a particular ancestor,
/// then it creates a provision node for the ancestor and adds itself
/// to the provision node. Other descendants of the same ancestor add
/// themselves to the previously created provision node.
2.
3.