Dapper.NET and IQueryable

喜你入骨 提交于 2019-12-03 11:53:36

问题


Is there a plan to make Dapper.net compatible with IQueryable interfaces? If not, what's the workaround to use Dapper with "Expression Trees" filters?


回答1:


No, there are no plans to do this. It is far far outside what dapper tries to do. So far that I would say it is antithetical. Dapper core tries to be the friend to those who love their SQL.




回答2:


You can get IQueryable from IEnumerable using the built-in extension method AsQueryable in System.Linq namespace

public IQueryable<Order> GetOrdersAsQuerable()
{
    IEnumerable<Order> qry= GetOrders(); //using Query<T>
    //use the built-in extension method  AsQueryable in  System.Linq namespace
    return qry.AsQueryable();            
}

Example



来源:https://stackoverflow.com/questions/27563096/dapper-net-and-iqueryable

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