Search code examples
asp.netsilverlightdynamics-crmwcf-ria-services

Remove cache on DomainService/DomainContext on the server from ASP.NET


I'm migrating a part of an app from Silverlight to ASP.NET, the Silverlight part uses RIA Services agains a Dynamics CRM. I'm reusing the DomainService from ASP.NET but have cache problems, so modifying an entity in a child window results in no new data from the parent if refreshed in less than a certain period of time, but the fresh data is already in the database.

I know you can override the cache behavior from a Silverlight client as stated in this question. But is this possible in an ASP.NET application?

I've also tried decorating the GetContacts method in the DomainService with [OutputCache(OutputCacheLocation.None, 0)] but it doesn't have any effect.


Solution

  • The problem was in the CrmDataContext class, which the DomainService uses. There's no documented way to clear it's cache, but there's a way on removing contents from the cache.