Skip to content

Commit 12b8ab0

Browse files
committed
CSHARP-938: Added doc comments for the MongoDB.Driver.Core Connections folder.
1 parent 5377e6c commit 12b8ab0

13 files changed

+287
-6
lines changed

src/MongoDB.Driver.Core/Core/Connections/BinaryConnectionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace MongoDB.Driver.Core.Connections
2424
/// <summary>
2525
/// Represents a factory of BinaryConnections.
2626
/// </summary>
27-
public class BinaryConnectionFactory : IConnectionFactory
27+
internal class BinaryConnectionFactory : IConnectionFactory
2828
{
2929
#region static
3030
// static fields

src/MongoDB.Driver.Core/Core/Connections/BuildInfoResult.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,31 @@
2626

2727
namespace MongoDB.Driver.Core.Connections
2828
{
29+
/// <summary>
30+
/// Represents the result of a buildInfo command.
31+
/// </summary>
2932
public sealed class BuildInfoResult : IEquatable<BuildInfoResult>
3033
{
3134
// fields
3235
private readonly BsonDocument _wrapped;
3336

3437
// constructors
38+
/// <summary>
39+
/// Initializes a new instance of the <see cref="BuildInfoResult"/> class.
40+
/// </summary>
41+
/// <param name="wrapped">The wrapped result document.</param>
3542
public BuildInfoResult(BsonDocument wrapped)
3643
{
3744
_wrapped = Ensure.IsNotNull(wrapped, "wrapped");
3845
}
3946

4047
// properties
48+
/// <summary>
49+
/// Gets the server version.
50+
/// </summary>
51+
/// <value>
52+
/// The server version.
53+
/// </value>
4154
public SemanticVersion ServerVersion
4255
{
4356
get
@@ -46,6 +59,12 @@ public SemanticVersion ServerVersion
4659
}
4760
}
4861

62+
/// <summary>
63+
/// Gets the wrapped result document.
64+
/// </summary>
65+
/// <value>
66+
/// The wrapped result document.
67+
/// </value>
4968
public BsonDocument Wrapped
5069
{
5170
get
@@ -55,6 +74,7 @@ public BsonDocument Wrapped
5574
}
5675

5776
// methods
77+
/// <inheritdoc/>
5878
public bool Equals(BuildInfoResult other)
5979
{
6080
if (other == null)
@@ -65,11 +85,13 @@ public bool Equals(BuildInfoResult other)
6585
return _wrapped.Equals(other._wrapped);
6686
}
6787

88+
/// <inheritdoc/>
6889
public override bool Equals(object obj)
6990
{
7091
return Equals(obj as BuildInfoResult);
7192
}
7293

94+
/// <inheritdoc/>
7395
public override int GetHashCode()
7496
{
7597
return _wrapped.GetHashCode();

src/MongoDB.Driver.Core/Core/Connections/ConnectionDescription.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
namespace MongoDB.Driver.Core.Connections
2121
{
22+
/// <summary>
23+
/// Represents information describing a connection.
24+
/// </summary>
2225
public sealed class ConnectionDescription : IEquatable<ConnectionDescription>
2326
{
2427
// fields
@@ -31,6 +34,12 @@ public sealed class ConnectionDescription : IEquatable<ConnectionDescription>
3134
private readonly SemanticVersion _serverVersion;
3235

3336
// constructors
37+
/// <summary>
38+
/// Initializes a new instance of the <see cref="ConnectionDescription"/> class.
39+
/// </summary>
40+
/// <param name="connectionId">The connection identifier.</param>
41+
/// <param name="isMasterResult">The issMaster result.</param>
42+
/// <param name="buildInfoResult">The buildInfo result.</param>
3443
public ConnectionDescription(ConnectionId connectionId, IsMasterResult isMasterResult, BuildInfoResult buildInfoResult)
3544
{
3645
_connectionId = Ensure.IsNotNull(connectionId, "connectionId");
@@ -44,47 +53,96 @@ public ConnectionDescription(ConnectionId connectionId, IsMasterResult isMasterR
4453
}
4554

4655
// properties
56+
/// <summary>
57+
/// Gets the buildInfo result.
58+
/// </summary>
59+
/// <value>
60+
/// The buildInfo result.
61+
/// </value>
4762
public BuildInfoResult BuildInfoResult
4863
{
4964
get { return _buildInfoResult; }
5065
}
5166

67+
/// <summary>
68+
/// Gets the connection identifier.
69+
/// </summary>
70+
/// <value>
71+
/// The connection identifier.
72+
/// </value>
5273
public ConnectionId ConnectionId
5374
{
5475
get { return _connectionId; }
5576
}
5677

78+
/// <summary>
79+
/// Gets the isMaster result.
80+
/// </summary>
81+
/// <value>
82+
/// The isMaster result.
83+
/// </value>
5784
public IsMasterResult IsMasterResult
5885
{
5986
get { return _isMasterResult; }
6087
}
6188

89+
/// <summary>
90+
/// Gets the maximum batch count.
91+
/// </summary>
92+
/// <value>
93+
/// The maximum batch count.
94+
/// </value>
6295
public int MaxBatchCount
6396
{
6497
get { return _maxBatchCount; }
6598
}
6699

100+
/// <summary>
101+
/// Gets the maximum size of a document.
102+
/// </summary>
103+
/// <value>
104+
/// The maximum size of a document.
105+
/// </value>
67106
public int MaxDocumentSize
68107
{
69108
get { return _maxDocumentSize; }
70109
}
71110

111+
/// <summary>
112+
/// Gets the maximum size of a message.
113+
/// </summary>
114+
/// <value>
115+
/// The maximum size of a message.
116+
/// </value>
72117
public int MaxMessageSize
73118
{
74119
get { return _maxMessageSize; }
75120
}
76121

122+
/// <summary>
123+
/// Gets the maximum size of a wire document.
124+
/// </summary>
125+
/// <value>
126+
/// The maximum size of a wire document.
127+
/// </value>
77128
public int MaxWireDocumentSize
78129
{
79130
get { return _maxDocumentSize + 16 * 1024; }
80131
}
81132

133+
/// <summary>
134+
/// Gets the server version.
135+
/// </summary>
136+
/// <value>
137+
/// The server version.
138+
/// </value>
82139
public SemanticVersion ServerVersion
83140
{
84141
get { return _serverVersion; }
85142
}
86143

87144
// methods
145+
/// <inheritdoc/>
88146
public bool Equals(ConnectionDescription other)
89147
{
90148
if (other == null)
@@ -98,11 +156,13 @@ public bool Equals(ConnectionDescription other)
98156
_isMasterResult.Equals(other._isMasterResult);
99157
}
100158

159+
/// <inheritdoc/>
101160
public override bool Equals(object obj)
102161
{
103162
return Equals(obj as ConnectionDescription);
104163
}
105164

165+
/// <inheritdoc/>
106166
public override int GetHashCode()
107167
{
108168
return new Hasher()
@@ -112,6 +172,11 @@ public override int GetHashCode()
112172
.GetHashCode();
113173
}
114174

175+
/// <summary>
176+
/// Returns a new instance of ConnectionDescription with a different connection identifier.
177+
/// </summary>
178+
/// <param name="value">The value.</param>
179+
/// <returns>A connection description.</returns>
115180
public ConnectionDescription WithConnectionId(ConnectionId value)
116181
{
117182
return _connectionId.StructurallyEquals(value) ? this : new ConnectionDescription(value, _isMasterResult, _buildInfoResult);

src/MongoDB.Driver.Core/Core/Connections/ConnectionExtensionMethods.cs renamed to src/MongoDB.Driver.Core/Core/Connections/ConnectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace MongoDB.Driver.Core.Connections
2929
/// <summary>
3030
/// Represents internal IConnection extension methods (used to easily access the IConnectionInternal methods).
3131
/// </summary>
32-
internal static class ConnectionExtensionMethods
32+
internal static class ConnectionExtensions
3333
{
3434
// static methods
3535
public static Task SendMessageAsync(this IConnection connection, RequestMessage message, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)

src/MongoDB.Driver.Core/Core/Connections/ConnectionId.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
namespace MongoDB.Driver.Core.Connections
3232
{
33+
/// <summary>
34+
/// Represents a connection identifier.
35+
/// </summary>
3336
[Serializable]
3437
public sealed class ConnectionId : IEquatable<ConnectionId>
3538
{
@@ -40,11 +43,20 @@ public sealed class ConnectionId : IEquatable<ConnectionId>
4043
private readonly int _hashCode;
4144

4245
// constructors
46+
/// <summary>
47+
/// Initializes a new instance of the <see cref="ConnectionId"/> class.
48+
/// </summary>
49+
/// <param name="serverId">The server identifier.</param>
4350
public ConnectionId(ServerId serverId)
4451
: this(serverId, IdGenerator<ConnectionId>.GetNextId())
4552
{
4653
}
4754

55+
/// <summary>
56+
/// Initializes a new instance of the <see cref="ConnectionId"/> class.
57+
/// </summary>
58+
/// <param name="serverId">The server identifier.</param>
59+
/// <param name="localValue">The local value.</param>
4860
public ConnectionId(ServerId serverId, int localValue)
4961
{
5062
_serverId = Ensure.IsNotNull(serverId, "serverId");
@@ -62,22 +74,41 @@ private ConnectionId(ServerId serverId, int localValue, int serverValue)
6274
}
6375

6476
// properties
77+
/// <summary>
78+
/// Gets the server identifier.
79+
/// </summary>
80+
/// <value>
81+
/// The server identifier.
82+
/// </value>
6583
public ServerId ServerId
6684
{
6785
get { return _serverId; }
6886
}
6987

88+
/// <summary>
89+
/// Gets the local value.
90+
/// </summary>
91+
/// <value>
92+
/// The local value.
93+
/// </value>
7094
public int LocalValue
7195
{
7296
get { return _localValue; }
7397
}
7498

99+
/// <summary>
100+
/// Gets the server value.
101+
/// </summary>
102+
/// <value>
103+
/// The server value.
104+
/// </value>
75105
public int? ServerValue
76106
{
77107
get { return _serverValue; }
78108
}
79109

80110
// methods
111+
/// <inheritdoc/>
81112
public bool Equals(ConnectionId other)
82113
{
83114
if (other == null)
@@ -90,16 +121,23 @@ public bool Equals(ConnectionId other)
90121
_localValue == other._localValue;
91122
}
92123

124+
/// <inheritdoc/>
93125
public override bool Equals(object obj)
94126
{
95127
return Equals(obj as ConnectionId);
96128
}
97129

130+
/// <inheritdoc/>
98131
public override int GetHashCode()
99132
{
100133
return _hashCode;
101134
}
102135

136+
/// <summary>
137+
/// Compares all fields of two ConnectionId instances (Equals ignores the ServerValue).
138+
/// </summary>
139+
/// <param name="other">The other ConnectionId.</param>
140+
/// <returns>True if both instances are equal.</returns>
103141
public bool StructurallyEquals(ConnectionId other)
104142
{
105143
if (other == null)
@@ -113,6 +151,7 @@ public bool StructurallyEquals(ConnectionId other)
113151
_serverValue == other._serverValue;
114152
}
115153

154+
/// <inheritdoc/>
116155
public override string ToString()
117156
{
118157
if (_serverValue == null)
@@ -125,6 +164,11 @@ public override string ToString()
125164
}
126165
}
127166

167+
/// <summary>
168+
/// Returns a new instance of ConnectionId with a new server value.
169+
/// </summary>
170+
/// <param name="serverValue">The server value.</param>
171+
/// <returns>A ConnectionId.</returns>
128172
public ConnectionId WithServerValue(int serverValue)
129173
{
130174
return new ConnectionId(_serverId, _localValue, serverValue);

0 commit comments

Comments
 (0)