File tree Expand file tree Collapse file tree 4 files changed +15
-10
lines changed
MongoDB.Driver.Encryption
MongoDB.Driver/Linq/Linq3Implementation/Ast Expand file tree Collapse file tree 4 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 14
14
*/
15
15
16
16
using System ;
17
- using MongoDB . Bson ;
18
17
19
- namespace MongoDB . Driver . Core . Misc
18
+ namespace MongoDB . Bson
20
19
{
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
22
24
{
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 )
24
30
{
25
31
return type switch
26
32
{
@@ -48,4 +54,4 @@ public static string ConvertBsonTypeToServerRepresentation(BsonType type)
48
54
} ;
49
55
}
50
56
}
51
- }
57
+ }
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ private static BsonDocument CreateEncryptDocument(
281
281
282
282
if ( bsonTypes != null )
283
283
{
284
- var convertedBsonTypes = bsonTypes . Select ( Utils . ConvertBsonTypeToServerRepresentation ) . ToList ( ) ;
284
+ var convertedBsonTypes = bsonTypes . Select ( type => type . ToStringRepresentation ( ) ) . ToList ( ) ;
285
285
286
286
if ( convertedBsonTypes . Count == 0 )
287
287
{
Original file line number Diff line number Diff line change 16
16
using System ;
17
17
using MongoDB . Bson ;
18
18
using MongoDB . Bson . Serialization ;
19
- using MongoDB . Driver . Core . Misc ;
20
19
21
20
namespace MongoDB . Driver . Linq . Linq3Implementation . Ast
22
21
{
23
22
internal static class AstEnumExtensions
24
23
{
25
- public static string Render ( this BsonType type ) => Utils . ConvertBsonTypeToServerRepresentation ( type ) ;
24
+ public static string Render ( this BsonType type ) => type . ToStringRepresentation ( ) ;
26
25
27
26
public static string Render ( this ByteOrder byteOrder )
28
27
{
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ public override BsonValue Render()
52
52
if ( _types . Count == 1 )
53
53
{
54
54
var type = _types [ 0 ] ;
55
- return new BsonDocument ( "$type" , Utils . ConvertBsonTypeToServerRepresentation ( type ) ) ;
55
+ return new BsonDocument ( "$type" , type . ToStringRepresentation ( ) ) ;
56
56
}
57
57
else
58
58
{
59
- return new BsonDocument ( "$type" , new BsonArray ( _types . Select ( Utils . ConvertBsonTypeToServerRepresentation ) ) ) ;
59
+ return new BsonDocument ( "$type" , new BsonArray ( _types . Select ( type => type . ToStringRepresentation ( ) ) ) ) ;
60
60
}
61
61
}
62
62
}
You can’t perform that action at this time.
0 commit comments