我有以下查询通过包容性的日期,得到的结果:LINQ查询:获取的所有领域,包括外键
var q = from x in db.TableX
where x.Timestamp.CompareTo(fromDate) >= 0
&& x.Timestamp.CompareTo(toDate) <= 0
select x;
我的TableX有一个以上的外键。然而,当我调试时,我只看到其中一个提取,而其他所有的键都是空的,即使我在数据库中看到它们不是空的,并且ID与它们的外部表连接。
public class TableX
{
public int Id { get; set; }
public string str1{ get; set; }
public Table2 t1{ get; set; }
public Table3 t2{ get; set; }
public Table4 t3{ get; set; }
public Table5 t4{ get; set; }
public Tablet5 t5{ get; set; }
}
你可以发布你的TableX类吗? – 2012-07-20 03:30:54
@Jayantha:我刚刚做到了。 – 2012-07-20 03:35:45