-
Type: New Feature
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.9.2
-
Component/s: BSON
-
None
It's currently a total pain when we want to make a schema migration (shortening a field name for example). We need to mark the old property with {{ [BsonIgnoreIfNull] }} (or {{ ...IfDefault] }} and that properties set the new property we'd like to use instead and make the old property always return null (or default). Not clean at all and difficult to read.
To my opinion a much cleaner way would be to have a custom attribute like:
{{ [BsonAllowedAlternateNames("name1",123,etc.)] }} that would allow that property to be set by those element names, only affecting deserialization of the documents (bson => c#) and not serialization.
I realize it could lead to deserialization conflicts: those conflicts could be managed by attribute settings (like "takes precedence" or so), and/or by a custom resolve method.
- duplicates
-
CSHARP-622 Add [MongoOldName("OldName")] attribute & updates to Linq provider
- Closed