What to put as the Provider for a mocked IQueryable

巧了我就是萌 提交于 2019-12-04 09:25:36

Simplest would be a List<T> which can be used as IQueryable<T> via .AsQueryable().

MolesDelegates.Func<IQueryProvider> provider = () => userLinqList.AsQueryable().Provider;

That's what I use as a in memory database to mock out Linq2Sql. Simple and elegant.

The simple solution would be to bind the list.AsQueryable() to the table. The IQueryable methods would automatically be rerouted to the list.

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