Dynamics CRM 2011 · Dynamics CRM 2013 · Dynamics CRM 2015 · Dynamics CRM 4.0 · Web Service · Workaround

CRM Service Connection Disable Caching

Dynamics CRM has caching functionality for performance reasons. However sometimes the latest updates don’t come through because of caching. There are two ways to get around this issue:

1. Web or App config
Caching can be disabled when connecting to CRM Service by configuring the context in config file.
Insert the following sections under <configuration></configuration> element.

  <configSections>
    <section name="microsoft.xrm.client" type="Microsoft.Xrm.Client.Configuration.CrmSection, Microsoft.Xrm.Client"/>
  </configSections>
  <microsoft.xrm.client>
    <contexts>
      <add name="Xrm" type="Xrm.XrmServiceContext, Xrm" serviceName="Xrm"/>
    </contexts>
    <services>
      <add name="Xrm" type="Microsoft.Xrm.Client.Services.OrganizationService, Microsoft.Xrm.Client"/>
    </services>
  </microsoft.xrm.client>

MSDN link

2. Programmatically

Microsoft.Xrm.Client.Caching.ObjectCacheManager.GetInstance().Clear();

Cheers,
Sy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s