Click here to Skip to main content
15,879,535 members
Articles / Programming Languages / C# 4.0
Tip/Trick

EF 4.1 Cached object performance tip

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
25 Jan 2012CPOL 14.8K   1   1
A performance tip for EF 4.1

The Find() method on your DbContext allows you to get a specific object, based on its primary key from the database the first time. Thereafter, it gets it from the context's cache, instead of making a round trip to the database each time you request that object. Thus, you get faster performance because there are no extra calls to the database.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer BBD Johannesburg
South Africa South Africa
Bsc (Hons) Business Information Systems.
MCTS: Web Applications Development with Microsoft .NET Framework 4
MCTS: Windows Communication Foundation Development with Microsoft .NET Framework 4
MCTS: Accessing Data with Microsoft .NET Framework 4
Microsoft Certified Professional Developer Certification.

Comments and Discussions

 
QuestionWebsite Pin
jratcliff774031-Jan-12 3:04
jratcliff774031-Jan-12 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.