EntityFramework Casting issues

*爱你&永不变心* 提交于 2019-12-04 17:24:16

Well, the error is accurate. You can't do that in an L2E query, because your interface (IReport) is not part of your entity model and hence can't be converted to SQL. You have to use an entity type, not an interface for that.

just create a partial class for the entity frameowrk object and make that implement the interface.

the other way would be to create a list of the type you want

then do a for each on the linq dataset and add the items to the collection.

the problem is caused because .net doesnt know how to cast List<ISomething> into a List<Something>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!