Dapper.NET and IQueryable

2019-03-17 19:09发布

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?

标签: c# lambda dapper
2条回答
疯言疯语
2楼-- · 2019-03-17 19:55

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.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-17 20:08

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

查看更多
登录 后发表回答