Skip to content

Commit 3483186

Browse files
committed
Revert "Removed extension"
This reverts commit c586c9f.
1 parent 1139985 commit 3483186

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/MongoDB.Driver/Core/Misc/Utils.cs renamed to src/MongoDB.Bson/ObjectModel/BsonTypeExtensions.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@
1414
*/
1515

1616
using System;
17-
using MongoDB.Bson;
1817

19-
namespace MongoDB.Driver.Core.Misc
18+
namespace MongoDB.Bson
2019
{
21-
internal static class Utils
20+
/// <summary>
21+
/// A static class containing extension methods for <see cref="BsonType"/>.
22+
/// </summary>
23+
public static class BsonTypeExtensions
2224
{
23-
public static string ConvertBsonTypeToServerRepresentation(BsonType type)
25+
/// <summary>
26+
/// Maps a <see cref="BsonType"/> to its corresponding string representation.
27+
/// </summary>
28+
/// <param name="type">The input type to map.</param>
29+
public static string ToStringRepresentation(this BsonType type)
2430
{
2531
return type switch
2632
{
@@ -48,4 +54,4 @@ public static string ConvertBsonTypeToServerRepresentation(BsonType type)
4854
};
4955
}
5056
}
51-
}
57+
}

src/MongoDB.Driver.Encryption/CsfleSchemaBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private static BsonDocument CreateEncryptDocument(
281281

282282
if (bsonTypes != null)
283283
{
284-
var convertedBsonTypes = bsonTypes.Select(Utils.ConvertBsonTypeToServerRepresentation).ToList();
284+
var convertedBsonTypes = bsonTypes.Select(type => type.ToStringRepresentation()).ToList();
285285

286286
if (convertedBsonTypes.Count == 0)
287287
{

src/MongoDB.Driver/Linq/Linq3Implementation/Ast/AstEnumExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
using System;
1717
using MongoDB.Bson;
1818
using MongoDB.Bson.Serialization;
19-
using MongoDB.Driver.Core.Misc;
2019

2120
namespace MongoDB.Driver.Linq.Linq3Implementation.Ast
2221
{
2322
internal static class AstEnumExtensions
2423
{
25-
public static string Render(this BsonType type) => Utils.ConvertBsonTypeToServerRepresentation(type);
24+
public static string Render(this BsonType type) => type.ToStringRepresentation();
2625

2726
public static string Render(this ByteOrder byteOrder)
2827
{

src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Filters/AstTypeFilterOperation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public override BsonValue Render()
5252
if (_types.Count == 1)
5353
{
5454
var type = _types[0];
55-
return new BsonDocument("$type", Utils.ConvertBsonTypeToServerRepresentation(type));
55+
return new BsonDocument("$type", type.ToStringRepresentation());
5656
}
5757
else
5858
{
59-
return new BsonDocument("$type", new BsonArray(_types.Select(Utils.ConvertBsonTypeToServerRepresentation)));
59+
return new BsonDocument("$type", new BsonArray(_types.Select(type => type.ToStringRepresentation())));
6060
}
6161
}
6262
}

0 commit comments

Comments
 (0)