both linqtosql and entityframework provide both features (deferred loading and data caching).
for example, if you initially load a customer, that customer will be cached and if you ask for it again you'll get the same instance.
if you don't load a customer's orders during that initial load, then the orders property of that customer instance will be in an unloaded state. when you do load those orders, then the order instances will be available through that property.
- linqtosql will load the property the first time it is used.
- entityframework will load the property when it is asked to do so (using the load method).
in both technologies, the context is the thing that does the caching... so if you use more than one context instance - you could observe different customer instances that really represent the same customer.
addressing your questions in comments. i'll be talking linqtosql, but this stuff should work in entityframework as well.
- here's an explanation of deferred vs immediate loading.
- here's an explanation of object identity and caching.
if i shut off deferred loading i take it the data caching will still work?
yes, that will work. however, they are not totally independent.
- here's how to turn off caching (it's on by default).
- here's how to turn of deferred loading (it's on by default). read this one, since it explains how these features interact.
is data cache flushing dependent on whether there are changes in datatable and or time?
there is no flushing or resetting the cache. if you want a fresh cache, the thing to do is to create a new datacontext. each instance of datacontext has its own cache.
- there is a way to pull update the cache with changes in the database aka - refresh.
- there is no way to push changes from the database to the cache.
- Is there a conflict when using Data Caching and Lazy loading?
- Does Queryability and Lazy Loading in C# blur the lines of Data Access vs Business Logic?
- Is a full list returned first and then filtered when using linq to sql to filter data from a database or just the filtered list?
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- how to recursive load n children in comment table when lazy loading and proxies is false?
- Loading data from XML Document throwing a NullReferenceException when using XDocument on Windows Phone 7
- EF ObjectDisposedException when lazy loading using virtual
- Loading and Filtering Huge Amount of Data using Linq
- how to fetch data from database using linq query for relationship 1:N and N:N (between 3 entity) in asp.net mvc EF code first?
- Is there anyway anonymous joins using linq may be performed when one of the datatypes is nullable and the other isn't?
- Entity-framework code is slow when using Include() many times
- Why does C# compiler create private DisplayClass when using LINQ method Any() and how can I avoid it?
- Differences between IEquatable<T>, IEqualityComparer<T>, and overriding .Equals() when using LINQ on a custom object collection?
- When using LINQ, what is the difference between && and multiple where clauses?
- EF Query using .Contains() and .ToLowerInvariant() Results in no matches when match is found at the end of a string
- I am wondering about the state of connection and impact on code performance by 'yield' while iterating over data reader object
- Forcing XDocument.ToString() to include the closing tag when there is no data
- Some data is missing in the Export to Excel using DataTable and Linq
- Access all of the data after joining two tables and group them using linq
- When using "yield" why does compiler-generated type implement both IEnumerable and IEnumerator
- Why is my code doing lazy loading even after I turned it off at every possible point?
- LINQ to SQL - Compile error when extending data context with partial class and methods
- LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
- Entity Framework Linq Query to List - Error when using contains: Only primitive types, enumeration types and entity types are supported
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- How to reuse a linq expression for 'Where' when using multiple source tables
- Avoiding code repetition when using LINQ
- Is there any benefit to calling .Any() before .ForEach() when using linq?
- What are the difference between .Select, .Any, and .Count when using LINQ
- Duplicate rows when using orderby, Skip() and Take() with LINQ
More Query from same tag
- Linq: Removing Group By but still get its items?
- How to handle pivoting POCOs?
- Find maximum depth/level of a nested collection
- Windows Form Controls and LINQ; What should I return?
- View my value in the top and the rest by
- How to apply Expression<Func<string,bool>> to a string property in Linq2Sql .Where() clause?
- Merge 2 collections and change a property of same objects
- Datatable Union using Linq
- Update specific cell in Dataset with LINQ
- How can I aggregate two List in some operation by using Linq?
- Returning the correct type in C# linq query over DataRows
- How to query nested json data in linq?
- How to extract month from date time feild?
- Linq Help- Where Is Not in where clause
- C# Linq copying values into model from different sources
- Datatable.GetChanges() always returns null
- I need to get multiple index's instead of one using linq
- Unity linq return matching object
- Why does this LINQ throw "FormatException was unhandled"?
- How to improve Query with linq
- LINQ query with GROUP BY and Count(*) into Anonymous Type
- Linq sql - where should I put phrase with "where"
- Iteratin trought LINQ with index in collection
- Linq Query for expected result
- many to one linq projection
- LINQ to SQL: SubmitChanges() does not work?
- Best way to implement extension methods
- LINQ filtering and aggregation
- Linq join on multiple tables with null values
- Retrieve the count of datarows where a column has a value