原文发布时间为:2011-04-01 —— 来源于本人的百度文章 [由搬家工具导入]

Linq join query displayed in MVC view

Instead of returning an IEnumerable of anonymous types, you could create a class for the join result and then create a model for it as normal:

var inactive = from usrs in ctn.aspnet_Users
where usrs.LastActivityDate <= duration
join o in ctn.Groups on
usrs.UserId equals o.UserID
select new InactiveUser(usrs.UserName, usrs.LastActivityDate, o.PrimaryPhoneNumber);

With an InactiveUser class which has a constructor which takes a UserName, Date and PhoneNumber.

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2022-03-09
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-25
  • 2022-01-14
  • 2022-12-23
  • 2021-09-09
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案