[CSHARP-579] Simplify a few method signatures in BsonReader and BsonWriter Created: 26/Sep/12  Updated: 14/May/14  Resolved: 05/Dec/12

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

Type: Improvement Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change

 Description   

When the IO namespace of the BSON library was originally written care was taken to make sure that it didn't depend on the BsonDocument object model. The reason was that we can implement more efficient serialization if there are no required intermediate data types, so the IO layer tends to work with primitive values. However, for a few BSON data types, that principle led to awkward method signatures.

So we are replacing:

// replace:
public abstract void ReadBinaryData(out byte[] bytes, out BsonBinarySubType subType, out GuidRepresentation guidRepresentation);
// with:
public abstract BsonBinaryData ReadBinaryData();
 
// add:
public abstract byte[] ReadBytes();
 
// replace:
public abstract void ReadObjectId(out int timestamp, out int machine, out short pid, out int increment);
// with:
public abstract ObjectId ReadObjectId();
 
// replace:
public abstract void ReadRegularExpression(out string pattern, out string options);
// with:
public abstract BsonRegularExpression ReadRegularExpression();

and similarly for BsonWriter.

These methods are very low level, and these will only be breaking changes to you if you used them to write custom serializers.



 Comments   
Comment by Robert Stam [ 05/Dec/12 ]

Pushed to master.

Comment by Robert Stam [ 29/Nov/12 ]

Reopened to backport to 1.8.

For 1.8, we will leave the existing methods but will mark them as deprecated and they will forward to the new methods.

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