'Trying to get object from CosmosDb via MVC app via client.CreateDocumentQuery

First attempt at accessing Cosmos db.

All this is in a DAL project layer of the solution (n-tier). EndPointURI and PrimaryKey and DBName are setup by the class constructor.

I execute the client.CreateDocumentQuery

But not seeing the expected cast to the out param of the function i.e. "user". I see the generated query string only.

I'm basing my code on this

public void  GetUserByEmail(string email, out IQueryable<Shared.User> user)
    {
        FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 };
        user = null;

        try
        { 
            user = this.client.CreateDocumentQuery<Shared.User>(
                       UriFactory.CreateDocumentCollectionUri(DBName, "Users"), queryOptions)
                       .Where(f => f.Email == email);
        }
        catch (Exception ex)
        {
        }

    }

enter image description here

If trying ReadDocumentAsync, I get the following enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source