-
Notifications
You must be signed in to change notification settings - Fork 24
DOCSP-45715: Sealed class v3.0 changes #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for mongodb-docs-csharp ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM + one suggestion!
source/upgrade/v3.txt
Outdated
``IBsonSerializer`` interface. | ||
|
||
- The ``MongoClient``, ``MongoDatabase``, and ``MongoCollection`` classes have been | ||
sealed. We recommend using the ``IMongoClient``, ``IMongoDatabase``, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: I'd update to active voice
- All concrete serializers have been sealed. To implement a custom serializer, implement the | |
``IBsonSerializer`` interface. | |
- The ``MongoClient``, ``MongoDatabase``, and ``MongoCollection`` classes have been | |
sealed. We recommend using the ``IMongoClient``, ``IMongoDatabase``, and | |
- The driver seals all concrete serializers. To implement a custom serializer, implement the | |
``IBsonSerializer`` interface. | |
- The driver seals the ``MongoClient``, ``MongoDatabase``, and ``MongoCollection`` classes. We recommend using the ``IMongoClient``, ``IMongoDatabase``, and |
@@ -84,7 +84,7 @@ The following code example shows a custom ``BsonRegularExpression`` serializer: | |||
|
|||
.. code-block:: csharp | |||
|
|||
class CustomRegularExpressionSerializer : SerializerBase<Regex> | |||
class CustomRegularExpressionSerializer : IBsonSerializer<Regex> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compile, so need to adapt the CustomRegularExpressionSerializer
accordingly.
source/upgrade/v3.txt
Outdated
cluster events, use `ClusterBuilder.Subscribe() <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Core.Configuration.ClusterBuilder.Subscribe.html>`__. | ||
|
||
- The driver seals all concrete serializers. To implement a custom serializer, implement the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had some questions of "why" classes got sealed.
It's worth adding a general comment followed by these concrete examples:
Something like "Some of the types that were not designed for extension via inheritance became sealed. Starting with 3.0 we recommend using "composition over inheritance" approach for extending the driver functionality."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(cherry picked from commit a927257)
(cherry picked from commit a927257)
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-45715 and https://jira.mongodb.org/browse/DOCSP-45716
Staging Links
Self-Review Checklist