[CSHARP-623] DOCS: BsonClassMap.RegisterClassMap to support WCF DataContract/DataMember attributes Created: 04/Nov/12  Updated: 02/Feb/18  Resolved: 02/Feb/18

Status: Closed
Project: C# Driver
Component/s: Serialization
Affects Version/s: 1.6.1
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Michael Bertelsen Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-696 Allow serialization to take into the ... Closed
Backwards Compatibility: Fully Compatible

 Description   

We have a lot of classes where the members is decorated with [DataMember]. It would be very nice if there was a AutoWcfMap in BsonClassMap that works as AutoMap but that looks at [DataMember] attributes instead.

Example:
BsonClassMap.RegisterClassMap<MyClass>(cm => cm.AutoWcfMap());

Would iterate over all members (public/private fields/properties) and see look for the DataMember attribute and call SetElementName, SetOrder, SetDefaultValue etc.

If the type have a member-type that is marked with the DataContract attribute and it is not currently a part of the registered types it should automatically map it too.



 Comments   
Comment by Robert Stam [ 02/Feb/18 ]

There are no current plans to support DataContract based serialization.

Comment by Craig Wilson [ 05/Nov/12 ]

You are completely free to write a convention to do this. See the docs here: http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial#CSharpDriverSerializationTutorial-Conventions for information on how to do that.

Generated at Wed Feb 07 21:37:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.