[CSHARP-1579] SetIdMember call being ignored. Created: 25/Feb/16 Updated: 26/Feb/16 Resolved: 26/Feb/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON, Serialization |
| Affects Version/s: | 2.2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | William Eidson | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I have code that used to work and has stopped. The code defines a member of a base class as the "ID" via the usual pattern. BsonClassMap.RegisterClassMap<Message>(cm => ); where UniqueID is a GUID. I Dropped the collection containing this type ( and its decendents) and reinstered an instance of a derived class. The database after the insert has an _id with an ObjectId in it !! A subsequent deserialize fails trying to make objectid into guid. Any thoughts on what I could have done to break this. |
| Comments |
| Comment by Craig Wilson [ 26/Feb/16 ] |
|
Thanks for the update William. |
| Comment by William Eidson [ 26/Feb/16 ] |
|
Ok, this is a big never mind. The BsonClassMapping is done in a static ctor. Someone removed the inital call to a static on that class which prevented the ctor from ever running! |
| Comment by William Eidson [ 25/Feb/16 ] |
|
additionally the db contains both an _id field and the UniqueID field within the _t of the object |