Monday, March 5, 2012

Is Something Missing in Your Organization Service? Check the Cache!

Today I am reposting my blog post from the Sonoma Partners blog.  Enjoy!

The Developer Extensions for Microsoft Dynamics CRM are extremely helpful tools for developing custom code for CRM.  They provide a simplified way to connect to the CRM Services with the ability to be configured and extended.

One ‘gotcha’ when using the CrmConfigurationManager class to connect to CRM is that the default configuration includes caching of the organization service.  A colleague of mine was running into an issue where the organization service wasn’t recognizing his newly created relationship when developing a query, so he had the need to disable caching.   

To do this, the App.config can be updated with the following XML:
2-22-2012 3-42-02 PM

Note that this requires the microsoft.xrm.client section to be declared in the App.config as well.  The full App.config should look something like this:
2-22-2012 3-44-52 PM
 
The examples above are covered in the following MSDN article http://msdn.microsoft.com/en-us/library/gg695805.aspx