Include路径表达式必须引用在类型上定义的导航属性。

时间:2017-02-16 07:45:13

标签: c# asp.net-mvc

  public int GetHighestMarks(int ClassID, int ExamId, int SubjectId)
    {
        List<ExamResult> ExamResultList = null;
        int highestMarks = 0;
        try
        {

            BaseDataRepository<ExamResult> db = new BaseDataRepository<ExamResult>();
            ExamResultList = db.GetList(S => S.ClassID.Equals(ClassID), e => e.ExamID.Equals(ExamId), s => s.SubjectID.Equals(SubjectId)).ToList();

            if (ExamResultList.Count > 0)
            {
                var MarksListConsolidated = ExamResultList
                                        .GroupBy(e => e.SubjectID)
                                        .Select(g => g.OrderByDescending(e => e.Marks).LastOrDefault())
                                        .Select(e => new
                                        {                                               
                                            e.Marks,                                        
                                        });
                highestMarks =Convert.ToInt16((from E in MarksListConsolidated                                    
                                  select E.Marks));
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return highestMarks;
    }

我在

中收到错误
ExamResultList = db.GetList(S => S.ClassID.Equals(ClassID), e => e.ExamID.Equals(ExamId), s => s.SubjectID.Equals(SubjectId)).ToList();

错误是:

[下午12:57] Sajjad Hussain:

&LT;&LT;&LT; ExamResultList = db.GetList(S =&gt; S.ClassID.Equals(ClassID),​​e =&gt; e.ExamID.Equals(ExamId),s =&gt; s.SubjectID.Equals(SubjectId))。ToList(); Sajjad Hussain,今天12:57 PMYe line me error araha hai niche wala

{&#34; Include路径表达式必须引用在该类型上定义的导航属性。使用虚线路径作为参考导航属性,使用选择运算符作为集合导航属性。\ r \ n参数名称:路径&#34;}

0 个答案:

没有答案