public IHttpActionResult ByLinq(int id, string query) { object obj; var type = RoslynHelper.Compile(query, out obj); using (var session = Store.Instance.OpenSession()) { //session.Advanced.DocumentQuery<Record>("Records/ByWebLog") // .SelectFields<WebLog>() // .Where(query); var result = type.InvokeMember("Compile", BindingFlags.Default | BindingFlags.InvokeMethod, null, obj, new object[] { session }); return(Ok(result)); } }