【发布时间】:2010-05-11 02:21:02
【问题描述】:
我有 Linq to Entity 查询,就像你在下面看到的那样,我在我的代码中使用了五次,所有变化都是 where 子句。是否可以创建一个方法并仅传递 where 值,而不是编写所有代码五次。谢谢
items = from t1 in _entities.table1
join t2 in _entities.Table2 on t1.column1 equals t2.column1
join t3 in _entities.Table3 on t1.column2 equals t3.column2
join t4 in _entities.Table4 on t1.column3 equals t4.column3
where **t1.column5 == Something**
select new
{
t1.column7,
t2.column8,
t3.column9,
t4.column10
};
【问题讨论】:
-
你没有导航属性吗?
标签: linq-to-entities