OrientDB-NET.binary
OrientDB-NET.binary copied to clipboard
Consider making ORIDs immutable
The setter should be removed in ORID.RID. This means that a RID cannot be overwritten. Id's should be immutable and never modifiable. It also makes RID consistent as there is no other assignment operator on ORID. Also RID should be changed to Rid. Actually I would eliminate RID and support ToString() to make it consistent with .NET conformance. And since ORIDs are no larger than a GUID, would consider making ORIDs a value type over a class type. This would also go to making ORIDs immutable. Take a look at how the Guid value type is defined and model the Orid value type around that.
I realize that an Orid cannot be a value type since the default state of an Orid is the Null Rid (#-1, -1). If define as a value type, the default state would be (#0,0) which represents the address of the database metadata. However I've made some changes to the existing code in a private fork where the driver make sure that it always returns Orid.Null for Orid types. This avoid checking Orids for the null value (albeit this is now made easier in C# 6.0 but IDs should never be null).
I've also fixed the Orid parsing and clean up some code areas using Reshaper. If you're interested I can send you my changes for your review.