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

Cannot hide base property

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON, Json.NET
    • Labels:
      None
    • Environment:
      Net Core 3.1

      Hi everyone,

      I'm currently stuck in this situation:

      class A
      {
          public DateTime CreatedOn \{ get; set; }
      }
      
      class B : A
      { 
          public new DateTimeOffset CreatedOn \{ get; set; }
      }
      

      Every time I try to get an IMongoCollection<B> I get this error:

      MongoDB.Bson.BsonSerializationException: 'The property 'CreatedOn' of type 'B' cannot use element name 'CreatedOn' because it is already being used by property 'CreatedOn' of type 'A`1.
      

      Is there any way to get around this problem?

      Thank you in advance,

      Luca

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            lbellavia@technogym.com Luca Bellavia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: