Example #1
0
            public void QueryRowCountInlineAndValue()
            {
                DataServiceQuery <northwindClient.Customers> q = (DataServiceQuery <northwindClient.Customers>)(from c in ctx.CreateQuery <northwindClient.Customers>("Customers").IncludeTotalCount()
                                                                                                                select c);

                QueryOperationResponse <northwindClient.Customers> r = (QueryOperationResponse <northwindClient.Customers>)q.Execute();
                long sc1 = r.TotalCount;

                q = (DataServiceQuery <northwindClient.Customers>)(from c in ctx.CreateQuery <northwindClient.Customers>("Customers")
                                                                   select c);
                long sc2 = q.LongCount();

                Assert.AreEqual(sc1, sc2);
            }
Example #2
0
            public void QueryRowCountInlineAndValueWithKeyPredicate()
            {
                DataServiceQuery <northwindClient.Customers> q =
                    ((DataServiceQuery <northwindClient.Customers>)
                         (from c in ctx.CreateQuery <northwindClient.Customers>("Customers").Where(cc => cc.CustomerID == "ALFKI")
                         select c)).IncludeCount();

                QueryOperationResponse <northwindClient.Customers> r = (QueryOperationResponse <northwindClient.Customers>)q.Execute();
                long sc1 = r.Count;

                q = (DataServiceQuery <northwindClient.Customers>)
                        (from c in ctx.CreateQuery <northwindClient.Customers>("Customers").Where(cc => cc.CustomerID == "ALFKI")
                        select c);
                long sc2 = q.LongCount();

                Assert.AreEqual(sc1, sc2);
            }