我要用前一个问题引导这个问题我问: LINQ to SQL: Multiple joins ON multiple Columns. Is this possible?
所以我有一个LINQ查询:
var query =
from t1 in myTABLE1List // List<TABLE_1>
join t2 in myTABLE1List
on new { t1.ColumnA, t1.ColumnB } equals new { t2.ColumnA, t2.ColumnB }
join t3 in myTABLE1List
on new { t2.ColumnA, t2.ColumnB } equals new { t3.ColumnA, t3.ColumnB }
select new {t1.ColumnA, t2.ColumnA, t3.ColumnA } // Duplicate Anon type 'ColumnA'
我该如何解决这个问题?
答案 0 :(得分:7)
明确命名匿名类型的属性
select new {t1A = t1.ColumnA, t2A = t2.ColumnA, t3A = t3.ColumnA }