【问题标题】:How to include more than one class while fetching from database如何在从数据库中获取时包含多个类
【发布时间】:2015-02-04 04:33:06
【问题描述】:

我想在获取时包含两个类。我知道如何用一门课做到这一点,但我不确定如何用两门课来做到这一点。

这里我包括学生

var service = dc.service.Include("Student").OrderBy(i => i.id);

我不知道如何同时添加学生和程序

【问题讨论】:

    标签: asp.net-mvc entity-framework asp.net-mvc-4 asp.net-mvc-5 datacontext


    【解决方案1】:

    您可以链接多个 Include 方法。

    var service = dc.service.Include("Student").Include("Program").OrderBy(i => i.id);
    

    【讨论】:

      猜你喜欢
      • 2017-09-17
      • 2021-09-08
      • 2011-04-05
      • 2013-03-13
      • 2015-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多