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

BsonClassSerializer should look for ShouldSerializeXyz methods and use them

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1
    • Affects Version/s: 1.0
    • Component/s: Feature Request
    • None

      These methods would allow the decision whether a particular property should be serialized to be made at runtime. This is similar to [BsonIgnoreIfNull] but allows the developer to use custom criteria to decide whether to serialize the property or not. For example:

      public class Employee {
      // other fields
      public string Zip;

      public bool ShouldSerializeZip(string value)

      { return value != null && value != "' && value != "00000"; }

      }

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

              Created:
              Updated:
              Resolved: