Should I avoid using Include in queries, or I can rely on the EDM that when it creates the query it excludes from the query items that already exist in the OSM?
When querying with 'Include', does the EF checks if objects already exist in object state manager?
1.7k Views Asked by Shimmy Weitzhandler At
1
There are 1 best solutions below
Related Questions in ENTITY-FRAMEWORK
- Entity Framework Code First with Fluent API Concurrency `DbUpdateConcurrencyException` Not Raising
- How to get primary key value with Entity Framework Core
- How do you add extra property using join
- Is there anyway to set the relationship of many tables from Model?
- ORM Code First versa Database First in Production
- MVC : Insert data to two tables
- Cannot insert a null into column MVC ASP.NET
- System.ComponentModel.DataAnnotations.Schema namespace conflict
- EF 6 interceptor to set connectionstring
- IQueryable<T> OrderBy<T> Extension Fails with Foreign Key Property
- Linq to Entities filter navigation collection properties
- How to generate entity framework code-first migrations without using the package manager console?
- Entity Framework and abstract class
- Validation DataGridView Windows Forms
- Require tool to trace the LInq Queries in Oracle
Related Questions in INCLUDE
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- SilverStripe - Multilingual Custom Form Template
- Interesting random PHP include issue
- Maddening scope issue
- PHP Include giving weird results
- VB.Net: Display total when check boxes are checked
- PHPBB3and super globals?
- Combine Fortran .for and .f90 include header files
- PHP include Page.php, if Page=404 { PHP include API { WRITE API as Page.php (Storing APIs on Servers)
- C++ #include <[filename]> but #include <string> is not a filename
- Make prepros watch Jade HTML include files
- Xcode 7 handling of include files changed
- Dynamic PHP Page Include (CMS / Blog)
- how to include script of variables in a class? undefined variable
- How to create an "include all" file?
Related Questions in NAVIGATION-PROPERTIES
- Send info to the view from another table with navigation property?
- How to add navigation property manually model first
- ChangeTracker doesn't show navigation property changes in Entity Framework
- EF Core Collection Load .. of a Collection
- Prevent EF6 from generate navigation properties
- How to get IdentityUser roles' names in View?
- Entity Framework 6.1: navigation properties not loading
- DropDownList DataTextField on Navigation property
- Navigation Properties on Post Action
- How Entity Framework navigation property is binded
- How Do You Determine the Parent Navigation Properties for an Entity Using Entity Framework
- Entity Framework Navigation property interface type
- Properly using the Navigation Property in Entity Framework
- EF codefirst : Should I initialize navigation properties?
- Maintainable and extensible navigation properties
Related Questions in OBJECTSTATEMANAGER
- ObjectStateManager couldn't recognize the object entry
- EntityDataSource Null Update Pameters not getting marked Modified
- Why do I get referenced entities added to context instead of attached, unchanged?
- EF4 ObjectStateManager not reporting changes?
- Nullreference exception in EntityFramework ObjectStateManager.DetectConflicts
- ObjectContext.Refresh()?
- When querying with 'Include', does the EF checks if objects already exist in object state manager?
- Dealing with complex properties with Entity Framework's ChangeTracker
- How can I get an object's values before the object is edited in a database?
- ObjectStateManager and Detached entity state
- Why does Entity Framework detect changes on properties which were modified but reset?
- An object with the same key already exists in the ObjectStateManager error in controller
- MVC5/EF6: Object cannot be deleted because it was not found in the ObjectStateManager?
- How to clear ObjectStateManager
- EF ObjectStateEntry OriginalValues contains CurrentValues
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I'm pretty certain that EF4 will use anything currently in the ObjectStateManager and only load objects it doesn't already have, but the best way to be sure is to simply test it with SQL Profiler running and see if that holds true for the way you're using it.
Certainly using the Include() method is recommended by the EF team, but if you choose to load the related rows later the ObjectStateManager will do 'relationship fix-up', which can be a very powerful feature to take advantage of.
Have a look at this blog entry:
http://blogs.msdn.com/alexj/archive/2009/10/13/tip-37-how-to-do-a-conditional-include.aspx
You'll find plenty of great articles on his blog regarding entity-framework.