Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-4895

.NET SDK Example code leads to bad programming practices

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • csharp, sdk
    • .NET

    Description

      The example code under "Storing and Getting a document" uses a "using" pattern where the Bucket object is created and used for the scope of getting a single document. This leads users learning the SDK the impression that this is the pattern they should use, and thus creating and disposing of Bucket objects for every Couchbase interaction. Best Practices state that the Bucket object should be used as a singleton object, being opened once and then used for all Couchbase interactions until the application is shutdown. This example code should be modified to use the existing bucket object created in the prior example on the page.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          Created this PR to remove the using statement usage with a bucket instance:
          https://github.com/couchbase/docs-sdk-dotnet/pull/33

          mike.goldsmith Michael Goldsmith added a comment - Created this PR to remove the using statement usage with a bucket instance: https://github.com/couchbase/docs-sdk-dotnet/pull/33

          Merged Mike's PR.
          Docs will be built to main site today.

          richard.smedley Richard Smedley added a comment - Merged Mike's PR. Docs will be built to main site today.

          People

            richard.smedley Richard Smedley
            davis.chapman Davis Chapman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty