-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.8
-
Component/s: None
-
None
-
Minor Change
I was using driver version 1.8 and used conventions in a following way:
var cp = new ConventionProfile();
cp.SetIgnoreIfNullConvention(new AlwaysIgnoreIfNullConvention());
cp.SetIgnoreExtraElementsConvention(new AlwaysIgnoreExtraElementsConvention());
BsonClassMap.RegisterConventions(cp, t => true);
This worked fine. Then I've updated driver to 1.8.1, and I found that strong typed version of IndexKeysBuilder do not work anymore.
A code similar to IndexKeys<JsonArticleUniversal>.Ascending(x => x.insertTime);
failed with exception "JsonArticleUniversal does not have insertTime property".
Of course it have this property, the code is compiling.
I looked through the driver sources and found how classmap works. Then I've updated conventions to use new classes and everything began to work.
I see, that legacy version are marked as obsolete, but they should either still work or be totally removed.
I think the best and easiest way to close this bug, it to make constructors for legacy convention classes private. This will break the code and draw attention to the spot, then developers will be able to quickly find new classes and fix the problem. Otherwise, you should fix and support legacy classes.