I have started to look in to the linq provider based on The Wayward WebLog http://blogs.msdn.com/b/mattwar/archive/2008/11/18/linq-links.aspx.
I have this code
DbQueryProvider provider = new DbQueryProvider();
Query<Product> productQuery = new Query<Product>(provider);
IEnumerable<Product> preProductList = productQuery.Where(p => p.Id < 0).Take(4);
ICollection<Product> productList = preProductList.ToList();
I have a lot of problems finding the Take(4), witch I want to translate into Top(4) sql statement.
It seems to me, that .Take(4) is set in the expression tree only as a constant, so I have no way of knowing if it is the Take function.
Has any of you.. and idea on how to make a TakeFinder based on expression ?