ADO.NET Data Services 'Astoria' and caching
I just started diving into ADO.NET Data Services for a project and I quickly ran into a problem. At first I was amazed at the performance, but then I realized that the data was cached. My project is based on real-time data, and I would really like to use the ADEST.NET data services request syntax (no WCF or SOAP), but no caching.
I saw on the ADO.NET Data Services Implementation page ( here ) that they don't yet have API support for managing cache duration or anything like that.
Anyone have any ideas on how to do this or disable the cache?
source to share
By default, the data context has a MergeOption set to AppendOnly. This means that repeated requests will only add new entities and will not update existing ones. Try setting MergeOption to OverwriteChanges:
this.context.MergeOption = MergeOption.OverwriteChanges;
It worked for me when I noticed it! If you are using live data, you can turn off change tracking entirely by using the NoTracking option.
source to share
We recently made a post on how to use ETags to control the policy for caching data returned from a data service http://blogs.msdn.com/astoriateam/archive/2008/04/22/optimistic-concurrency-data-services.aspx
source to share