Dapper.NET and IQueryable

后端 未结 2 1418
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 04:22

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?

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 05:00

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

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

    Example

提交回复
热议问题