Exemple #1
0
        public void TimingsShouldWork()
        {
            using (var store = GetDocumentStore())
            {
                using (var session = store.OpenSession())
                {
                    session.Store(new Company {
                        Name = "CF"
                    });
                    session.Store(new Company {
                        Name = "HR"
                    });

                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    QueryTimings timings   = null;
                    var          companies = session.Query <Company>()
                                             .Customize(x => x.Timings(out timings))
                                             .Where(x => x.Name != "HR")
                                             .ToList();

                    Assert.True(timings.DurationInMs > 0);
                    Assert.NotNull(timings.Timings);
                }
            }
        }
Exemple #2
0
        public void IncludeTimings(out QueryTimings timings)
        {
            if (QueryTimings != null)
            {
                timings = QueryTimings;
                return;
            }

            QueryTimings = timings = new QueryTimings();
        }
Exemple #3
0
        public QueryTimings ToTimings()
        {
            var timings = new QueryTimings
            {
                DurationInMs = (long)Duration.TotalMilliseconds
            };

            if (Scopes != null)
            {
                foreach (var scope in Scopes)
                {
                    if (timings.Timings == null)
                    {
                        timings.Timings = new SortedDictionary <string, QueryTimings>();
                    }

                    timings.Timings[scope.Key] = scope.Value.ToTimings();
                }
            }

            return(timings);
        }
 IAsyncGraphQuery <T> IQueryBase <T, IAsyncGraphQuery <T> > .Timings(out QueryTimings timings)
 {
     Timings(out timings);
     return(this);
 }
 /// <inheritdoc />
 public IDocumentQueryCustomization Timings(out QueryTimings timings)
 {
     IncludeTimings(out timings);
     return(this);
 }
Exemple #6
0
 /// <inheritdoc />
 IRawDocumentQuery <T> IQueryBase <T, IRawDocumentQuery <T> > .Timings(out QueryTimings timings)
 {
     IncludeTimings(out timings);
     return(this);
 }