LINQ to Entities 不识别方法“System.String get_Item(Int32)”,因此该方法无法转换为存储表达式。


1、LINQ to Entities 不识别方法“System.String get_Item(Int32)”,因此该方法无法转换为存储表达式。项目中发现linq to entities 不识别? ,为何大家都要腰间盘,你的如此突出。

 Expression<Func<Models.GroupMemberModel, bool>> epression = ep => (ep.GroupId.Equals(gm.GroupId) && ep.MemberId.Equals(gm.members[i]));
 var model = dbcontext.groupmember.Where(epression);

后来测试发现把具体的值直接带进去是可以的,折腾一番直接定义一个变量,问题解决了。

string memberId = gm.members[i].ToString();
Expression
<Func<Models.GroupMemberModel, bool>> epression = ep => (ep.GroupId.Equals(gm.GroupId) && ep.MemberId.Equals(memberId)); var model = dbcontext.groupmember.Where(epression);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM