title: LINQ Query - Display customers with their number of orders including the customer with no orders
body: <p>In the following LINQ Query I need to display <code>All</code> the customers with total number of their orders placed including the customers that have not placed any orders:</p>
  
  <p><strong>Models</strong>:</p>
  
  <pre><code>Public class Customer
  {
     public int CustomerId { get; set; }
     public string Name{ get; set; }
  }
  
  Public class Order
  {
     public int OrderId { get; set; }
     public int CustomerId { get; set; }
  }
  </code></pre>
  
  <p><strong>LINQ Query</strong>: Question: How can I display <code>ALL</code> customers (including the one that have no order) and total number of orders per customer (zero for those whose customerID is not in Orders table)</p>
  
  <pre><code>var Query1 = from c in Customers
               join o in Orders into co
               from t in co.DefaultIfEmpty()
               select new {CustomerID = c.CustomerId, OrderID = (t == null ? 0 : t.OrderId)};
  </code></pre>