Reputation: 173
I'm trying to follow the azure DocumentDb quick start project. The app I will be developing will be in WPF rather than the console, so to ramp up 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 extension method 'CreateDatabaseQuery' accepting a first argument of type 'Microsoft.Azure.Documents.Client.DocumentClient' could be found (are you missing a using directive or an assembly reference?)
I used the following command to install the azure documentdb client:
Install-Package Microsoft.Azure.Documents.Client -Pre
This is the code that is giving me the issue (lifted straight from the quick start tutorial):
DocumentClient client = new DocumentClient(new Uri("endpoint"), "authKey");
var db = client.CreateDatabaseQuery()
.Where(d => d.Id == databaseId)
.AsEnumerable()
.FirstOrDefault();
This is the contents 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>
Anybody any ideas what I'm missing? I'm using Visual Studio 2013 Premium Update 4
Upvotes: 3
Views: 1978
Reputation: 8119
I believe you are missing the using
directive for the DocumentDB Linq provider (Microsoft.Azure.Documents.Linq
). Please make sure you have the following directives to the top of your .cs file:
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
Upvotes: 7