I’m using mongDb with MongoDrive, I wonder how I can implement to all my classes the [BsonIgnoreExtraElements].
I know there is a way through the ConventionProfile, but I do not know how to implement it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit
Per Evereq’s comment, the below is obsolete. Now use:
Use the
SetIgnoreExtraElementsConventionmethod (from the Conventions section of the C# Driver Serialization Tutorial):The parameter
(type) => trueis a predicate depending on the class type, that determines whether to apply the convention. So per your requirement it should simply return true regardless; but you could use this to set/exclude the convention on given types if you wanted.