LINQ to Entities does not recognize the method and this method cannot be translated into a store expression

后端 未结 2 419
傲寒
傲寒 2021-01-02 05:01

I call some date in my database using entity frame work. but My below code giving this error

LINQ to Entities does not recognize the method \'SchoolBreifcase

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 05:32

    It's about the compliance[i].ComplianceId. Create a variable first:

    var id = compliance[i].ComplianceId;
    
    financialCompliance = datamodel.FinancialCompliances
                          .Where(f => f.ComplianceId == id).SingleOrDefault();
    

提交回复
热议问题