The CrmOnlineOrganizationService is an IOrganizationService that provides fault handling capabilities using the Transient Fault Handling Application Block. This custom organization service is tuned to detect particular errors returned during read operations. In the event of a transient error, the service performs a retry strategy to attempt to recover from the error.

The CrmOnlineOrganizationService only attempts a retry strategy for the following read requests:

  • RetrieveRequest
  • RetrieveMultipleRequest
  • RetrieveAllEntitiesRequest
  • RetrieveAllOptionSetsRequest
  • RetrieveAllManagedPropertiesRequest
  • RetrieveAttributeRequest
  • RetrieveEntityRequest
  • RetrieveRelationshipRequest
  • RetrieveTimestampRequest
  • RetrieveOptionSetRequest
  • RetrieveManagedPropertyRequest

The following exceptions are flagged as transient errors:

  • CommunicationException
  • WebException
  • SqlException
  • TimeoutException 

For all other exceptions, the service does not perform retry behavior and simply executes the base IOrganizationService.

Configuration

To enable the CrmOnlineOrganizationService, ensure that the application project contains a reference to the following assemblies:

  • Microsoft.Practices.EnterpriseLibrary.Common.dll
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.dll
  • Microsoft.Practices.ServiceLocation.dll
  • Microsoft.Practices.TransientFaultHandling.Core.dll

Apply the following configuration:

<configuration>

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

 <microsoft.xrm.client>
  <services>
   <add
    name="Xrm"
    type="Adxstudio.Xrm.Services.CrmOnlineOrganizationService, Adxstudio.Xrm"
    retryCount="3"
    retryInterval="00:00:00" [HH:MM:SS]
    retryStrategyName=""
    />
  </services>
 </microsoft.xrm.client>

</configuration>

By default the service is configured for a fixed interval retry strategy by performing a maximum of three retries without waiting between retries. The "retryStrategyName" setting can be used to point to more advanced configurations.