O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing queries directly

Although you could, at least theoretically, use ExecuteStoreCommand() to run queries on the server, doing so doesn’t make much sense, because the method only returns the number of records affected, not the records themselves. For querying, the ObjectContext class exposes the ExecuteStoreQuery<T>() method, and the equivalent DbSet<T> method is SqlQuery():

Image

Image Take A Break

We’ve only just touched the surface of the capabilities both ObjectContext and DbContext provide for executing commands directly on the server. It’s not ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required