See http://blogs.gotdotnet.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx