views:

746

answers:

4

Hello all,

I just started diving into ADO.NET Data Services for a project, and I quickly ran into a problem. At first I was amazed by the performance, but then I realized that the data was cached. My project relies on real-time data, and I'd love to use the ADO.NET Data Services REST query syntax (without needing to use WCF or SOAP), but without caching.

I saw on the ADO.NET Data Services introduction page (here) that they do not yet have API support for managing the cache duration or anything of the like.

Anyone have any ideas of how to accomplish this, or turn off the cache?

Thanks, Paul

+2  A: 

Hi , We made a post recently about how to use ETags to control the caching policy of data returned from a Data Service , http://blogs.msdn.com/astoriateam/archive/2008/04/22/optimistic-concurrency-data-services.aspx

Phani Raj
A: 

That link is helpful, but it doesn't really talk about ETags and caching, it just mentions that ETags can be used for caching. Do you have an example?

Paul
A: 

In depth details on the ETag

Robert MacLean
+2  A: 

By default the data context has MergeOption set to AppendOnly. This means that re-requests will only add new entities and will not update existing ones. Try setting MergeOption to OverwriteChanges:

this.context.MergeOption = MergeOption.OverwriteChanges;

This worked for me when I noticed this! If you're using real time data then you might want to turn off change tracking completely with the NoTracking option.

Simon Steele