How to apply BsonRepresentation attribute by convention when using MongoDB

Viewed 2638

I'm trying to apply [BsonRepresentation(BsonType.ObjectId)] to all ids represented as strings withoput having to decorate all my ids with the attribute.

I tried adding the StringObjectIdIdGeneratorConvention but that doesn't seem to sort it.

Any ideas?

2 Answers
Related