File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change 1
- using System ;
1
+ /* Copyright 2010-2012 10gen Inc.
2
+ *
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ using System ;
2
17
using System . Collections . Generic ;
3
18
using System . Linq ;
4
19
using System . Text ;
@@ -28,4 +43,4 @@ public IBsonSerializer GetSerializer(Type type)
28
43
return null ;
29
44
}
30
45
}
31
- }
46
+ }
Original file line number Diff line number Diff line change 19
19
using System . Collections . ObjectModel ;
20
20
using System . Collections . Specialized ;
21
21
using System . Drawing ;
22
- using System . Drawing . Imaging ;
23
22
using System . Globalization ;
24
- using System . IO ;
25
23
using System . Linq ;
26
24
using System . Net ;
27
- using System . Reflection ;
28
- using System . Text ;
29
- using System . Text . RegularExpressions ;
30
25
31
- using MongoDB . Bson . IO ;
32
- using MongoDB . Bson . Serialization . Attributes ;
33
- using MongoDB . Bson . Serialization . Conventions ;
34
26
using MongoDB . Bson . Serialization . Serializers ;
35
27
36
28
namespace MongoDB . Bson . Serialization
@@ -41,7 +33,6 @@ namespace MongoDB.Bson.Serialization
41
33
internal class BsonDefaultSerializationProvider : IBsonSerializationProvider
42
34
{
43
35
// private static fields
44
- private static BsonDefaultSerializationProvider __instance = new BsonDefaultSerializationProvider ( ) ;
45
36
private static Dictionary < Type , IBsonSerializer > __serializers ;
46
37
private static Dictionary < Type , Type > __genericSerializerDefinitions ;
47
38
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public static class BsonSerializer
50
50
// static constructor
51
51
static BsonSerializer ( )
52
52
{
53
- RegisterDefaultSerializationProvider ( ) ;
53
+ RegisterDefaultSerializationProviders ( ) ;
54
54
RegisterIdGenerators ( ) ;
55
55
}
56
56
@@ -834,7 +834,7 @@ internal static void EnsureKnownTypesAreRegistered(Type nominalType)
834
834
var knownTypesAttribute = nominalType . GetCustomAttributes ( typeof ( BsonKnownTypesAttribute ) , false ) ;
835
835
if ( knownTypesAttribute != null && knownTypesAttribute . Length > 0 )
836
836
{
837
- //try and force a scan of the known types
837
+ // try and force a scan of the known types
838
838
LookupSerializer ( nominalType ) ;
839
839
}
840
840
@@ -848,9 +848,9 @@ internal static void EnsureKnownTypesAreRegistered(Type nominalType)
848
848
}
849
849
850
850
// private static methods
851
- private static void RegisterDefaultSerializationProvider ( )
851
+ private static void RegisterDefaultSerializationProviders ( )
852
852
{
853
- //These are run in reverse order.
853
+ // last one registered gets first chance at providing the serializer
854
854
RegisterSerializationProvider ( new BsonClassMapSerializationProvider ( ) ) ;
855
855
RegisterSerializationProvider ( new BsonDefaultSerializationProvider ( ) ) ;
856
856
}
You can’t perform that action at this time.
0 commit comments