分类:
EF
linq写法:
//linq写法 var query = (from u in oae.Users join p in oae.User_Parent on u.Id equals p.UsersId select new { username = u.UserName, fahter = p.Father, mother = p.Mother }).ToList();
lamdba写法:
/* * 第一个参数 : join的表 * 第二,三参数: join的参数 * 第四个参数 : 返回值 * */ List<UserViewModel> result = oae.Users.Join(oae.User_Parent, a => a.Id, b => b.UsersId, (u, p) => new UserViewModel { UserName = u.UserName, Father = p.Father, Mother = p.Mother }).ToList();
欢迎加群讨论技术,群:677373950(满了,可以加,但通过不了),2群:656732739
评价