Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-369

BsonIgnoreExtraElementsAttribute inheritable?

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 1.4
    • Affects Version/s: 1.3.1
    • Component/s: None
    • Fully Compatible

      BsonIgnoreExtraElementsAttribute
      Could you consider adding the inherited option? I realize this might break older code if I understand correctly. In that case could you consider adding a new "BsonIgnoreExtraElementsAttributeInherited" (or something) attribute which is exactly the same but with the inherited = true option.

      Maybe I'm on the wrong track tough, would love feedback on this.

      My problem is that I am creating a repository on which all entities inherit from the Entity class; for my use-case it would be preferable to have all entities ignore extra elements when present and I don't like adding the BsonIgnoreExtraElementsAttribute to each and every entity.

      I also tried inheriting from the BsonIgnoreExtraElementsAttribute e.g. "MyIgnore") and although it worked on the class I applied the "MyIgnore" attribute to, the inherited classes didn't ignore extra elements even though the MyIgnore had the inherited option set to true.

      Again, I might be on the wrong track here; please correct me if I'm wrong.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robiii Rob Janssen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: