Skip to content

Commit ea83737

Browse files
salarosrstam
authored andcommitted
adding missing parentesis in polymorphism examples
probably a typo
1 parent 8493e28 commit ea83737

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Docs/reference/content/reference/bson/mapping/polymorphism.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ BsonClassMap.RegisterClassMap<MyClass>(cm => {
4343
When deserializing polymorphic classes, it is important that the serializer know about all the classes in the hierarchy before deserialization begins. If you ever see an error message about an “Unknown discriminator”, it is because the deserializer can’t figure out the class for that discriminator. If you are mapping your classes programmatically simply make sure that all classes in the hierarchy have been mapped before beginning deserialization. When using attributes and [automapping]({{< relref "reference\bson\mapping\index.md#automap" >}}), you will need to inform the serializer about known types (i.e. subclasses) it should create class maps for. Here is an example of how to do this:
4444

4545
```csharp
46-
[BsonKnownTypes(typeof(Cat), typeof(Dog)]
46+
[BsonKnownTypes(typeof(Cat), typeof(Dog))]
4747
public class Animal
4848
{
4949
}
5050

51-
[BsonKnownTypes(typeof(Lion), typeof(Tiger)]
51+
[BsonKnownTypes(typeof(Lion), typeof(Tiger))]
5252
public class Cat : Animal
5353
{
5454
}
@@ -132,4 +132,4 @@ The main reason you might choose to use hierarchical discriminators is because i
132132

133133
```csharp
134134
var filter = new BsonDocument("_t", "Cat");
135-
```
135+
```

0 commit comments

Comments
 (0)