Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2140

Getting a document as a POCO doesn't serialize content properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 3.0.0-beta.2
    • None
    • None
    • None
    • 1

    Description

      Raised on behalf of danny1122.

      When getting a document, eg Airport defined in try-cb-dotnet, and using ContentAs<Airport>, the deserialisation does not work correctly.

      If the deserialization type is set as Dictionary<string, Airport> it works with the first element having a key of "".

       

      Code snippet provided by Danny:

      // Expected synatx (works in sdk3a, gives airport with all null fields in sdk3ß)var result = await _couchbaseService.DefaultCollection.GetAsync("airport_1254", new GetOptions());var unpacked = result.ContentAs<Airport>();​// In sdk3ß, unpacking into `dynamic` reveals the structure of the result to be {"" : {the_airport_object}}​// Required syntax to unpack into Airport object in sdk3ßvar result =  await _couchbaseService.DefaultCollection.GetAsync("airport_1254", new GetOptions());var unpacked = result.ContentAs<Dictionary<string, Airport>>();// Returns a Dictionary of "" -> correctly filled out airport object 

      Attachments

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

        Activity

          People

            mike.goldsmith Michael Goldsmith
            mike.goldsmith Michael Goldsmith
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty