Accepted answer

Future and all methods like DeferredFirst are extension methods on IQueryable<T>:

public static QueryFutureEnumerable<T> Future<T>(this IQueryable<T> query)

Database.SqlQuery returns DbRawSqlQuery<T>, which implements IEnumerable<T>, not IQueryable<T>, so the extension doesn't apply. There's no way to execute SqlQuerys in one Future batch with other queries.

You can alleviate some of the "pain" by opening the context's connection before executing a mix of queries and closing it afterwards. That prevents EF from closing and opening the connection for each individual query it executes. It's not the same as executing queries in deferrable batches, but it may add some efficiency.


Related Query

More Query from same tag