[CSHARP-28] Oid should behave more like Guid (struct, immutable, and == support) Created: 11/Mar/10  Updated: 15/Mar/10  Resolved: 15/Mar/10

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Andrew Rondeau Assignee: Sam Corder
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Backwards Compatibility: 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.)



 Comments   
Comment by Sam Corder [ 15/Mar/10 ]

Made immutable and added value type semantic methods and operators. Will be in 0.82

Generated at Wed Feb 07 21:35:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.