Entity framework run direct query
I'm thinking about using Entity F开发者_StackOverflow社区ramework in an ASP.NET application, using an Oracle database. I would also need to know is I can run a query directly on the database tables and data, using Entity Framework, without using the classes and the mappings. Thanks!
ExecuteStoreQuery can be used.
However, part of the beauty/fun/elegance of using Entity is being able to write your queries using LINQ and not having to write actual SQL statements.
Also, just because you decide to use Entity, doesn't mean you can no longer use SqlCommand objects etc...
You could use ExecuteStoreQuery() for that. Be aware though that you a have to provide a type that all returned columns can be mapped to, it does not have to be an entity though.
精彩评论