Bson Representation can not be applied to properties with ValueConverters

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Unknown
    • 8.2.2
    • Affects Version/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      A property can be defined as having a Bson Representation:

      mb.Entity<Customer>().Property(e => e.Value).HasRepresentation(BsonType.Decimal128); 

      And it can also be defined as having a ValueConverter

      mb.Entity<Customer>().Property(e => e.Value).HasConversion<Decimal128>(); 

      However if you use these two features together the Bson Representation is silently dropped.

      mb.Entity<Customer>().Property(e => e.Value).HasConversion<Decimal128>().HasRepresentation(BsonType.Decimal128); 

      Will store the vaule as a string (the default for Decimal128).

      This scenario is likely uncommon but should be fixed. ValueConverterSerializer will need to be extended to support IRepresentationConfigurable and IRepresentationConverterConfigurable.

       

            Assignee:
            Damien Guard
            Reporter:
            Damien Guard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: