开发者

Optimizing Entity Framework

开发者 https://www.devze.com 2023-03-15 17:48 出处:网络
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?

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 cachin开发者_Python百科g, how can I tune it? (with MySQL it's so simple).


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.

0

精彩评论

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