1414*/
1515
1616using System ;
17+ using System . Text ;
1718using MongoDB . Bson ;
1819
1920namespace MongoDB . Driver
@@ -32,6 +33,7 @@ public static class MongoDefaults
3233 private static int __maxConnectionPoolSize = 100 ;
3334 private static int __maxMessageLength = 16000000 ; // 16MB (not 16 MiB!)
3435 private static int __minConnectionPoolSize = 0 ;
36+ private static UTF8Encoding __readEncoding = new UTF8Encoding ( false , true ) ;
3537#pragma warning disable 612 , 618
3638 private static SafeMode __safeMode = SafeMode . False ;
3739#pragma warning restore
@@ -42,6 +44,7 @@ public static class MongoDefaults
4244 private static double __waitQueueMultiple = 5.0 ; // default wait queue multiple is 5.0
4345 private static int __waitQueueSize = 0 ; // use multiple by default
4446 private static TimeSpan __waitQueueTimeout = TimeSpan . FromMinutes ( 2 ) ; // default wait queue timeout is 2 minutes
47+ private static UTF8Encoding __writeEncoding = new UTF8Encoding ( false , true ) ;
4548
4649 // public static properties
4750 /// <summary>
@@ -152,6 +155,22 @@ public static int MinConnectionPoolSize
152155 set { __minConnectionPoolSize = value ; }
153156 }
154157
158+ /// <summary>
159+ /// Gets or sets the Read Encoding.
160+ /// </summary>
161+ public static UTF8Encoding ReadEncoding
162+ {
163+ get { return __readEncoding ; }
164+ set
165+ {
166+ if ( value == null )
167+ {
168+ throw new ArgumentNullException ( "value" ) ;
169+ }
170+ __readEncoding = value ;
171+ }
172+ }
173+
155174 /// <summary>
156175 /// Gets or sets the safe mode.
157176 /// </summary>
@@ -233,5 +252,21 @@ public static TimeSpan WaitQueueTimeout
233252 get { return __waitQueueTimeout ; }
234253 set { __waitQueueTimeout = value ; }
235254 }
255+
256+ /// <summary>
257+ /// Gets or sets the Write Encoding.
258+ /// </summary>
259+ public static UTF8Encoding WriteEncoding
260+ {
261+ get { return __writeEncoding ; }
262+ set
263+ {
264+ if ( value == null )
265+ {
266+ throw new ArgumentNullException ( "value" ) ;
267+ }
268+ __writeEncoding = value ;
269+ }
270+ }
236271 }
237272}
0 commit comments