public async Task GetValueAsync()

in src/WebJobs.Extensions.CosmosDB/Bindings/CosmosDBItemValueBinder.cs [41:72]


        public async Task<object> GetValueAsync()
        {
            T document = default(T);

            PartitionKey partitionKey = _context.ResolvedAttribute.PartitionKey == null ? PartitionKey.None : new PartitionKey(_context.ResolvedAttribute.PartitionKey);

            try
            {
                // Strings need to be handled differently.
                if (typeof(T) != typeof(string))
                {
                    document = await _context.Service.GetContainer(_context.ResolvedAttribute.DatabaseName, _context.ResolvedAttribute.ContainerName)
                        .ReadItemAsync<T>(_context.ResolvedAttribute.Id, partitionKey);

                    _originalItem = JObject.FromObject(document);
                }
                else
                {
                    JObject jObject = await _context.Service.GetContainer(_context.ResolvedAttribute.DatabaseName, _context.ResolvedAttribute.ContainerName)
                            .ReadItemAsync<JObject>(_context.ResolvedAttribute.Id, partitionKey);
                    _originalItem = jObject;

                    document = _originalItem.ToString(Formatting.None) as T;
                }
            }
            catch (CosmosException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
            {
                // ignore not found; we'll return null below
            }

            return document;
        }