BSON Customer Serializer - determine if type is being used as Id field

76 views Asked by At

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?

0

There are 0 answers