2018-01-26 · 知道合伙人软件行家
excellentmcoinEntities dbcontext = new excellentmcoinEntities();
//实例化viewmodel实体
List<userModel> listUser = new List<userModel>();
//t_user,t_grade,t_states,t_charcater四张表联查,抽取中其中的字段
listUser = (from u in dbcontext.t_user
join g in dbcontext.t_grade on u.gradeID equals g.gradeID
join s in dbcontext.t_states on u.state equals s.statesID
join c in dbcontext.t_character on u.levelID equals c.levelID
select new userModel()
{
userID=u.userID,
userName=u.userName,
userGrade=g.userGrade,
userStates=s.userSates,
userLevel=c.userLevel,
totalMcoin=u.totalMcoin
}).ToList();
return listUser;
Join吗?