Skip to content

Commit 1139985

Browse files
committed
Removed extension
1 parent 8479c00 commit 1139985

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

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(type => type.ToStringRepresentation()).ToList();
284+
var convertedBsonTypes = bsonTypes.Select(Utils.ConvertBsonTypeToServerRepresentation).ToList();
285285

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

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

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

1616
using System;
17+
using MongoDB.Bson;
1718

18-
namespace MongoDB.Bson
19+
namespace MongoDB.Driver.Core.Misc
1920
{
20-
/// <summary>
21-
/// A static class containing extension methods for <see cref="BsonType"/>.
22-
/// </summary>
23-
public static class BsonTypeExtensions
21+
internal static class Utils
2422
{
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)
23+
public static string ConvertBsonTypeToServerRepresentation(BsonType type)
3024
{
3125
return type switch
3226
{
@@ -54,4 +48,4 @@ public static string ToStringRepresentation(this BsonType type)
5448
};
5549
}
5650
}
57-
}
51+
}

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

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

2021
namespace MongoDB.Driver.Linq.Linq3Implementation.Ast
2122
{
2223
internal static class AstEnumExtensions
2324
{
24-
public static string Render(this BsonType type) => type.ToStringRepresentation();
25+
public static string Render(this BsonType type) => Utils.ConvertBsonTypeToServerRepresentation(type);
2526

2627
public static string Render(this ByteOrder byteOrder)
2728
{

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", type.ToStringRepresentation());
55+
return new BsonDocument("$type", Utils.ConvertBsonTypeToServerRepresentation(type));
5656
}
5757
else
5858
{
59-
return new BsonDocument("$type", new BsonArray(_types.Select(type => type.ToStringRepresentation())));
59+
return new BsonDocument("$type", new BsonArray(_types.Select(Utils.ConvertBsonTypeToServerRepresentation)));
6060
}
6161
}
6262
}

0 commit comments

Comments
 (0)