Esempio n. 1
0
        public ViewsFixture()
        {
            Artists = TestData.Artists.CreateArtists(10);

            _client = IntegrationTestsRuntime.CreateClient();

            var bulk = new BulkCommand();
            bulk.Include(Artists.Select(i => _client.Entities.Serializer.Serialize(i)).ToArray());

            var bulkResponse = _client.Documents.BulkAsync(bulk);

            foreach (var row in bulkResponse.Result.Rows)
            {
                var artist = Artists.Single(i => i.ArtistId == row.Id);
                _client.Entities.Reflector.RevMember.SetValueTo(artist, row.Rev);
            }

            _client.Documents.PostAsync(TestData.Views.Artists).Wait();

            var touchView1 = new ViewQuery(TestData.Views.ArtistsAlbumsViewId).Configure(q => q.Stale(Stale.UpdateAfter));
            var touchView2 = new ViewQuery(TestData.Views.ArtistsNameNoValueViewId).Configure(q => q.Stale(Stale.UpdateAfter));

            _client.Views.RunQueryAsync(touchView1).Wait();
            _client.Views.RunQueryAsync(touchView2).Wait();
        }
Esempio n. 2
0
 private static void ViewsUsingTypedRunQueryApi(IClient client)
 {
     Console.WriteLine("***** ***** ViewsUsingNonTypedRunQueryApi ***** *****");
     var query = new ViewQuery("artists", "albums").Configure(o => o.Limit(5).Reduce(false));
     var result = client.Views.RunQuery<Album[]>(query);
     Console.WriteLine(result);
 }