5

Entity Framework is fine but some queries are sub-optimal. Can one write some SQL queries by hand or as MS SQL Server 2008 R2 views, execute this selects and then associate somehow entities with them? I examined some generated SQL and they are quite ugly...

Question 2: Is MS SQL Server 2008 R2 caching queries? I'd like to have strong caching, how can I tune it? (with MySQL it's so simple).

1
  • You can select from a view, or if you need more control, you can put your SQL statements into a stored procedure and use that from Entity Framework (especially useful for INSERT, UPDATE, DELETE operations). And yes- SQL Server does a lot of caching and puts a lot of effort into keeping the most used pages in memory Commented Jun 26, 2011 at 18:49

1 Answer 1

5

You have a lot of options available to you. You can use .ExecuteStoreCommand() in EF 4.1 to execute SQL against the database, or you can map stored procedures into EF as well. Furthermore, you can map views as entities in EF if that's necessary.

SQL Server has very sophisticated caching mechanisms for data pages as well as execution plans , and it's pretty much automatic to the developer. I would suggest posting a question with concrete example with the operations you want to optimize.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.