[CSHARP-569] BsonId attribute does not opt-in the member. Created: 14/Sep/12 Updated: 20/Mar/14 Resolved: 01/Jan/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.6 |
| Fix Version/s: | 1.8 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Zaid Masud | Assignee: | Craig Wilson |
| Resolution: | Done | Votes: | 0 |
| Labels: | C#, driver, insert | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The ID field on an object is supposed to be populated after an Insert; however this does not work when the id field is private. In particular, the following unit test fails:
I saw this example in Robert's stack overflow answer here. |
| Comments |
| Comment by Craig Wilson [ 01/Jan/13 ] |
|
This has been resolved with the implementation of |
| Comment by Craig Wilson [ 14/Sep/12 ] |
|
This looks like a bug in that we aren't picking up the [BsonId] attribute on the private field and therefore not picking up the private field either. For now, you could add a [BsonElement] attribute to it or include it using the fluent configuration api. Alternatively, you can create a custom IMemberFinderConvention or a custom IIdMemberFinderConvention to include this guy into the mix. |