Skip to content

关于this.AddProperties(bsonDocument, logEvent);内部方法问题 #15

Open
@wheeky

Description

@wheeky

private BsonDocument CreateDocument(LogEventInfo logEvent) { BsonDocument bsonDocument = new BsonDocument(); if (this.IncludeDefaults || this.Fields.Count == 0) { this.AddDefaults(bsonDocument, logEvent); } foreach (MongoField current in this.Fields) { BsonValue value = this.GetValue(current, logEvent); if (value != null) { bsonDocument.set_Item(current.Name, value); } } this.AddProperties(bsonDocument, logEvent); return bsonDocument; }
这个方法能否设为虚方法,以便通过继承重写满足不同的插入到MONGO DB的字段格式,目前当我想把自定义字段加入到mongoDB中时,发现this.AddProperties(bsonDocument, logEvent);会把mongoTarget.Properties与eventInfo.Properties的字段都插入到mongoDB中,eventInfo.Properties存在于mongoDB的Properties键对面对应的字段,如果想输出自定义字段,那么则会造成mongoDB中的字段与Properties键对面对应的字段存在重复字段的情况,需要改善

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions