Exemple #1
0
 public void CrossApplyTest()
 {
     using (var session = Domain.OpenSession()) {
         using (session.OpenTransaction()) {
             LoadData(session);
             long total = 0;
             foreach (var customer in allCustomers)
             {
                 total += allInvoices.Count(o => o.Customer == customer);
             }
             var parameter = new ApplyParameter();
             var subquery  = orderPrimary
                             .Filter(t => t.GetValue(invoiceCustomerIndex) == parameter.Value.GetValue(customerIdIndex))
                             .Alias("XYZ");
             var result = customerPrimary
                          .Apply(parameter, subquery)
                          .Count(Session.Current);
             Assert.AreEqual(total, result);
         }
     }
 }