Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

Disable Caching In CRM Organization Service

Leave a comment

MS CRM has caching feature but sometimes you want to disable it to get the latest updates,two ways to disable caching
First way – Configuration

Add the following configuration block to the config file of your application

<configSections>

<sectionname="microsoft.xrm.client"type="Microsoft.Xrm.Client.Configuration.CrmSection, Microsoft.Xrm.Client"/>

</configSections>

<microsoft.xrm.client>

<contexts>

<addname="Xrm"type="Xrm.XrmServiceContext, Xrm"serviceName="Xrm"/>

</contexts>

<services>

<addname="Xrm"type="Microsoft.Xrm.Client.Services.OrganizationService, Microsoft.Xrm.Client"/>

</services>

</microsoft.xrm.client>
Second Way – Pragmatically

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

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