First of all my motivation is I want to be able to serialize
System.Diagnostics.EventLogEntry without having to do any magic or creating
a PODO class with all the properties.
Anyway, some classes like EventLogEntry have readonly properties, and you
want to insert these classes into the database, even if you never read data
back into the same classes. I was thinking the following:
- Create ReadonlyPublicMemberFinderConvention that will serialize to
readonly properties
- Create an internal collection of readonly serializers.
- Create a static method called BsonSerializer.
LookupReadonlySerializer() that populates this collection
- Then have the serialization calls look in this collection first (which
will only ever be explicitly populated) then the read/write collection. The
deserialization calls simply won't look here.
Justin