简体   繁体   中英

How-To Convert IQueryable Expression Tree to Lambda

How can i convert a IQueryable Expression Tree to a Expression<Func<T,bool>> Expression.

IQueryable<Book> Books;

var query = Books.Where(p => p.Author.AuthorId == 5);

Expression<Func<Book, bool>> expression = ?????

您可以使用IQueryable.Expression属性来访问IQueryable的Expression树。

Expression<Func<Book, bool>> expression = p => p.Author.AuthorId == 5;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM