DocumentClient.CreateDatabaseQuery - no definition

I am trying to do a DocumentDb quickstart project. The app I will be developing will be in WPF, not console, so to build on documentdb I created a new wpf project (.Net 4.5.1), but I get the following error:

Microsoft.Azure.Documents.Client.DocumentClient does not contain a definition for CreateDatabaseQuery and no CreateDatabaseQuery extension method that takes a first argument of type Microsoft.Azure.Documents.Client.DocumentClient (you are missing a using directive or a reference to assembly?)

I used the following command to install azure documentdb client:

Install Package Microsoft.Azure.Documents.Client -Pre

This is the code that gives me the problem (brought up straight from the quickstart tutorial):

            DocumentClient client = new DocumentClient(new Uri("endpoint"), "authKey");    
            var db = client.CreateDatabaseQuery()
                            .Where(d => d.Id == databaseId)
                            .AsEnumerable()
                            .FirstOrDefault();

      

This is the content of my Nuget Packages.config file

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.Documents.Client" version="0.9.1-preview" targetFramework="net451" />
  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" />
</packages>

      

Does anyone know what I am missing? I am using Visual Studio 2013 Premium Update 4

+3


source to share


1 answer


I believe you did not specify a directive using

for the DocumentDB Linq ( Microsoft.Azure.Documents.Linq

) provider . Make sure you have the following directives at the top of your .cs file:



using Microsoft.Azure.Documents; 
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq; 

      

+7


source







All Articles