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

Oid should behave more like Guid (struct, immutable, and == support)

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None
    • All
    • Minor Change

    Description

      The Oid type should behave more like .Net's Guid type. Specifically, the Guid is a struct, it's immutable, and it supports ==. This kind of behavior is implied with Oid, because it's used in a similar manner to a Guid.

      To look at Guid's source code (for Mono,) visit http://www.koders.com/csharp/fidADC2F00C9F6F285FD431871996B21D22EE4339A7.aspx

      I've posted a potential fix. They're at http://github.com/GWBasic/mongodb-csharp/commit/3e6e72f46d12429a949b607b08171cc13f62cd92 and http://github.com/GWBasic/mongodb-csharp/commit/840a0968fc9d7671ed8fec3a81e423958355a8af My fix follows the Guid class's style.

      This is a slightly breaking change for some small cases. The Value property is now replaced with ToByteArray(). Also, an Oid's value can't be changed, so anyone who set an Oid's "Value" property will need to refactor. (Again, this is consistant with Guid's behavior.)

      Attachments

        Activity

          People

            sam Sam Corder
            gwbasic Andrew Rondeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: