Allows us to get all class maps out of BsonClassMap.
added AllClassMaps - to enable us to get all the currently registered…
… class maps out of BsonClassMap
Good idea Alex. We'll discuss pulling this in.
just wondering if there was any update on this?
Alex, there is an IsClassMapRegistered method? Is this suitable for what you need, or is there another reason you would like to have a list.
There is, and while that works, it doesn't allow me to get all mapped types, without iterating over my types, and running .IsClassMapRegistered on each one...
@craiggwilson I could do with this feature from @alexjamesbrown as well, as I need to call the "Reset" method on each of them. Without a stored list, this does not perform well at all...
It would really make life a lot easier for people...
As a temp solution, I am using the following...
typeof(BsonClassMap).GetField("__classMaps", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null)
Yeah, but again, not ideal
This pull request literally just returns __classMaps.Values as a public IEnumerable<BsonClassMap>
It's even covered by unit tests!
Would make the lives of people wanting this functionality so much easier.
Fully agree with you that the temp solution I am using is not ideal, and I would much rather have your pull request and a couple other bits from the Experiment branch, as I have to do a lot of dirty hacks to get what I need currently.
in code review... track at https://jira.mongodb.org/browse/CSHARP-628.
I renamed the method to GetRegisteredClassMaps().
pushed to master