开发者

Entity framework run direct query

开发者 https://www.devze.com 2023-02-19 09:54 出处:网络
I\'m thinking about using Entity F开发者_StackOverflow社区ramework in an ASP.NET application, using an Oracle database.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消