I decided to move one of my projects to Entity Framework 7 (rc1-final). I am targeting SQL Server and EntityFramework.MicrosoftSqlServer
package is also installed.
I have only one problem: it seems like I can't execute custom SQL query in order to fetch some objects from DB.
DatabaseFacade
object (which can be accessed via DbContext.Database
property) provides an extension method ExecuteSqlCommand
(that returns nothing), But it does not provide SqlQuery<T>
method that allows to fetch objects. Both methods were available in good old EF 6, but new EF 7 declares only first one.
So, is SqlQuery<T>
method still here (but moved/renamed) or it was entirely removed from new EF implementation?
Of course it is absolutely possible to solve it in a verbose way (using SqlCommand
and its ExecuteReader
method) but I prefer to avoid it.