这是实体3:
public class A {
public aa m1;
public bb m2;
}
查询到值:
IOrderedQueryable<实体1> aa= from m in tab1 orderby m.ID_RI select m;
IOrderedQueryable<实体2> bb= from t in tab2 orderby t.ID select t;
我给实体3赋值是
return View(new A{ m1 = (实体1)aa, m2 = (实体2)bb});
------解决方案--------------------
------解决方案--------------------
你首先要确认 实体3里面的m1和m2元素的类型是aa 和bb实体,他们是单一元素: public class A { public aa m1; public bb m2; } 但,你在返回A时,却用集合 public class Run { public IEnumerable<Models.TB_KD_RunInfo> m1 { get; set; } public IEnumerable<Models.TB_KD_RunInfoDetail> m2 { get; set; } } 对m1 和m2进行赋值,是当然不行了,
这里应该这样写: public class Run { public Models.TB_KD_RunInfo m1 { get; set; } public Models.TB_KD_RunInfoDetail m2 { get; set; } }