使用c#查询documentdb

时间:2018-01-12 11:22:08

标签: c# azure-cosmosdb

我想使用下面的代码查询DocumentDB,但是获得异常

  

"未处理的类型' System.TypeInitializationException'"

的例外

有人能提出一些建议吗?感谢

    private const string EndpointUrl = @"myEndpointUrl";
    private const string PrimaryKey = "myKey";
    private DocumentClient client;

    static void Main(string[] args)
    {
        try
        {
            DocumentClient client = new DocumentClient(new Uri(EndpointUrl), PrimaryKey);
            var query = client.CreateDocumentQuery(
  "dbs/myDB/colls/myColl",
  "SELECT c.TestRun.dateFinish FROM c order by c.TestRun.dateFinish desc").ToList();
            Console.ReadLine();

        }
        catch (Exception)
        {

            throw;
        }

    }

0 个答案:

没有答案