title: LINQ query with left outer join
body: <p>I saw several of these examples and I think I am doing the syntax correctly, but I am getting an error that is not intuitive (to me anyway).</p>
  
  <p>The <code>customersIds</code> come in as a string that is a comma separated list and here is my code:</p>
  
  <pre><code>        customerIds = "," + customerIds + ",";
          var customerRebills = context.Shipments.AsNoTracking().Where(x =&gt; customerIds.IndexOf("," + x.CustomerId + ",") &gt;= 0)
              .Join(context.Customers.AsNoTracking(),
                  im =&gt; im.CustomerId,
                  cu =&gt; cu.CustomerId,
                  (im, cu) =&gt; new { Shipments = im, Customers = cu }).DefaultIfEmpty()
              .Join(context.Suppliers.AsNoTracking(),
                  im =&gt; im.Shipments.SupplierId,
                  su =&gt; su.SupplierId,
                  (im, su) =&gt; new { Shipments = im.Shipments, Customers = im.Customers, Suppliers = su }).DefaultIfEmpty()
              .Join(context.MatchingAssignments.AsNoTracking(),
                  im =&gt; new {im.Shipments.TrackingNumber, im.Shipments.CarrierInvoiceNumber},
                  ma =&gt; new { ma.TrackingNumber, ma.CarrierInvoiceNumber},
                  (im, ma) =&gt; new { Shipments = im.Shipments, Suppliers = im.Suppliers, Customers = im.Customers, MatchingAssignments = ma }).DefaultIfEmpty()
              .Join(context.MatchResolutions.AsNoTracking(),
                  ma =&gt; ma.MatchingAssignments.MatchReasonId,
                  mr =&gt; mr.MatchResolutionId,
                  (ma, mr) =&gt; new { MatchingAssignments = ma.MatchingAssignments, Shipments = ma.Shipments, Suppliers = ma.Suppliers, Customers = ma.Customers, MatchResolutions = mr }).DefaultIfEmpty()
              .GroupJoin(context.RebillingNotes.AsNoTracking(),
                  im =&gt; new {im.Shipments.TrackingNumber, im.Shipments.CarrierInvoiceNumber},
                  rn =&gt; new {rn.TrackingNumber, rn.InvoiceNumber},
                  (im, rn) =&gt; new { MatchingAssignments = im.MatchingAssignments, Shipments = im.Shipments, Suppliers = im.Suppliers, MatchResolutions = im.MatchResolutions, Customers = im.Customers, RebillingNotes = rn })
              .SelectMany(
                  x =&gt; x.RebillingNotes.DefaultIfEmpty(),
                  (x, y) =&gt; new {MatchingAssignments = x.MatchingAssignments, Shipments = x.Shipments, Suppliers = x.Suppliers, MatchingResolutions = x.MatchResolutions, Customers = x.Customers, RebillingNotes = y})
  </code></pre>
  
  <p>This code works fine when the last join is on one field:</p>
  
  <pre><code>            .GroupJoin(context.RebillingNotes.AsNoTracking(),
                  im =&gt; im.Shipments.TrackingNumber, 
                  rn =&gt; rn.TrackingNumber, 
                  (im, rn) =&gt; new { MatchingAssignments = im.MatchingAssignments, Shipments = im.Shipments, Suppliers = im.Suppliers, MatchResolutions = im.MatchResolutions, Customers = im.Customers, RebillingNotes = rn })
              .SelectMany(
                  x =&gt; x.RebillingNotes.DefaultIfEmpty(),
                  (x, y) =&gt; new {MatchingAssignments = x.MatchingAssignments, Shipments = x.Shipments, Suppliers = x.Suppliers, MatchingResolutions = x.MatchResolutions, Customers = x.Customers, RebillingNotes = y})
  </code></pre>
  
  <p>I thought it was a matter of creating objects containing the multiple fields.</p>
  
  <p>The error I am receiving is:</p>
  
  <blockquote>
    <p>CS0411    The type arguments for method 'Queryable.GroupJoin(IQueryable, IEnumerable,
    Expression>, Expression>,
    Expression, TResult>>)' cannot be
    inferred from the usage. Try specifying the type arguments explicitly.</p>
  </blockquote>
  
  <p>Thank you</p>