Entity Framework 4: Many to Many relationship IQueryable instead of ICollection

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:29:43

No there is no way to have navigation property as IQueryable but you can change the collection to IQueryable by using:

IQueryable<Article> query = context.Entry(category).Collection(c => c.articles).Query();
query.Where(...).Load();

Generally your "algorithm" looks pretty strange. You want to work with base class but in the same time you want to access child properties. That sounds wrong and it can most probably be solved in better way (non "generic" way is also better).

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