1

I have written a custom Bson Serializer by extending SerializerBase<T>

When serializing, I'd like to detect whether the object being serialized is being used as the Id field for the overall document.

If it is, I'd like to serialize as a string.

If not, I'll serialize as a document.

Is this possible and if so, how? Is this information available either thru the BsonSerializationContext or the BsonSerializationArgs?

Suraj
  • 35,905
  • 47
  • 139
  • 250
  • I can suggest to separate your serializer to two serializers one for `Id`s another one for others, and using an interface for `Id`s ;). – shA.t Dec 24 '16 at 08:34

0 Answers0