Esempio n. 1
0
        public async Task GetMovieByTitleSql(string parameter)
        {
            var movies = await _graphClient.ExecuteSQL <Movie>($"select * from c where c.label = 'Movie' and c.title = '{parameter}'");

            ConsoleHelpers.ConsoleLine(movies.Result);
            ConsoleHelpers.ConsoleLine($"Success: {movies.IsSuccessful}. Execution Time: {movies.ExecutionTime.TotalSeconds.ToString("#.##")} s. Execution cost: {movies.RequestCharge} RUs");
        }
        public async Task ReadMultiWithSql()
        {
            var readMovies = await _cosmosClient.ExecuteSQL <MovieFullGraph>($"select * from c where c.label = 'Movie'");

            Assert.IsTrue(readMovies.IsSuccessful);

            var readVertices = await _cosmosClient.ReadVertices <MovieFullGraph>();

            Assert.IsTrue(readVertices.IsSuccessful);

            Assert.AreEqual(readMovies.Result.Count(), readVertices.Result.Count());

            var read = await _cosmosClient.ExecuteSQL <string>($"SELECT VALUE c.Title[0]._value FROM c where c.label = 'Movie'");

            Assert.IsTrue(read.IsSuccessful);
        }