0

I've got two question, please see the following codes:

var table1 = from a in test1
             join b in test2 on a.column1 equals b.column1 into jo
             from jb in jo.DefaultIfEmpty()
             select new
             {
                col1 = jb == null ? <question 1> : jb.column1
             }

var table2 = from a in test3
             join b in test4 on a.column1 equals b.column1 into jo
             from jb in jo.DefaultIfEmpty()
             select new
             {
                col1 = jb == null ? <question 1> : jb.column1
             }

var table3 = from x in table1
             join y in table2 on x.col1 equals y.col1 into jo
             from jb in jo.DefaultIfEmpty()
             {
                  col1 = jb == null ? <question 1> : jb.col1
             }

var table4 = from z in table1.Concat(table2)
             select new TheTables()
             {
                 column1 = x.col1
             }

1st Question: Is it possible to put a "null" value instead of placing a default value in the statement? I've tried "col1 = jb == null ? null : jb.column1" but it throws an exception:

The argument to DbIsNullExpression must refer to a primitive, enumeration or reference type.

2nd Question: From the code that I've given above, when I do "table4.List()" will this query the database as combined statements or it will query table1, then table2, and then join it in the memory as table3?

2
  • I think you meant into jo from jb in jo.DefaultIfEmpty()
    – Silvermind
    May 7, 2014 at 7:24
  • hahaha, sorry I missed that, thank you for the tip. :) May 7, 2014 at 8:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.