Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

EF 4.1 Cached object performance tip

, 25 Jan 2012
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

Dean Oliver
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 Pinmemberjratcliff774031-Jan-12 3:04 
Does this method work across web site calls?
I know objects are destroyed between web calls.

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 25 Jan 2012
Article Copyright 2012 by Dean Oliver
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid