Complete port of Query.

Query, QueryOptions, Queryrow and QueryEnumerator  compile, but LiveQuery is still only stubbed out.