Skip to content

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

Merged
merged 5 commits into from
Dec 6, 2024

Conversation

mcmorisi
Copy link
Collaborator

@mcmorisi mcmorisi commented Dec 3, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-45715 and https://jira.mongodb.org/browse/DOCSP-45716

Staging Links

  • fundamentals/serialization
  • upgrade/v3
  • Self-Review Checklist

    • Is this free of any warnings or errors in the RST?
    • Did you run a spell-check?
    • Did you run a grammar-check?
    • Are all the links working?
    • Are the facets and meta keywords accurate?

    Copy link

    netlify bot commented Dec 3, 2024

    Deploy Preview for mongodb-docs-csharp ready!

    Name Link
    🔨 Latest commit fa0f0db
    🔍 Latest deploy log https://app.netlify.com/sites/mongodb-docs-csharp/deploys/67530456efd3c20008856b8a
    😎 Deploy Preview https://deploy-preview-345--mongodb-docs-csharp.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @mcmorisi mcmorisi marked this pull request as ready for review December 3, 2024 20:45
    Copy link
    Collaborator

    @norareidy norareidy left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM + one suggestion!

    Comment on lines 208 to 212
    ``IBsonSerializer`` interface.

    - The ``MongoClient``, ``MongoDatabase``, and ``MongoCollection`` classes have been
    sealed. We recommend using the ``IMongoClient``, ``IMongoDatabase``, and
    Copy link
    Collaborator

    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

    Suggested change
    - 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

    @mcmorisi mcmorisi requested a review from BorisDog December 3, 2024 21:29
    @@ -84,7 +84,7 @@ The following code example shows a custom ``BsonRegularExpression`` serializer:

    .. code-block:: csharp

    class CustomRegularExpressionSerializer : SerializerBase<Regex>
    class CustomRegularExpressionSerializer : IBsonSerializer<Regex>
    Copy link
    Collaborator

    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.

    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
    Copy link
    Collaborator

    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."

    @mcmorisi mcmorisi requested a review from BorisDog December 4, 2024 21:21
    Copy link
    Collaborator

    @BorisDog BorisDog left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM

    @mcmorisi mcmorisi merged commit a927257 into mongodb:master Dec 6, 2024
    6 checks passed
    @mcmorisi mcmorisi deleted the DOCSP-45715-sealed-classes branch December 6, 2024 21:22
    mcmorisi added a commit that referenced this pull request Dec 6, 2024
    mcmorisi added a commit that referenced this pull request Dec 6, 2024
    mongoKart pushed a commit to mongoKart/docs-csharp that referenced this pull request May 16, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants