user48545
user48545

Reputation: 3421

Is it possible to set the actual SQL that the entity framework provider will execute?

My entity framework provider (CoreLabs/Mysql/devart) is creating ridiculously slow queries.

is it possible for me to set the actual sql query that will be executed?

Thanks

Upvotes: 3

Views: 357

Answers (2)

kay.one
kay.one

Reputation: 7692

its funny, i was just watching LINQPad - New Features for Entity Framework. half way through the webcast, he showed the script generated by the EF and the same query generated by Linq-To-Sql; the linq-to-sql generated script was way more efficient. Now i don't know if using linq-to-sql is an option for you but i thought you should know,

in regards to your question, as i understand the whole point of EF and Linq-to-sql to avoid programmers writing TSQL in strings, doesn't force feeding your own SQL command kind of defeat the whole purpose of EF and Linq-to-sql?

Upvotes: 1

Andrew Peters
Andrew Peters

Reputation: 11333

Yes, one way is with the ObjectQuery.ToTraceString API.

Upvotes: 0

Related Questions