Search code examples
cachingdynamics-crm-2011crmxrm

How to disable CRM 2011 Xrm caching?


I have problem with crm 2011 caching. I don't need it, but I don't know how to disable it.

First I generate this:

CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Outputcs /url:https://crmaddress/XRMServices/2011/Organization.svc /username:usr/password:pw /namespace:ns/serviceContextName:XrmServiceContext

then I have the following code:

   private XrmServiceContext _crmService;

    public CrmWS()
    {
        CrmConnection _connection = new CrmConnection();
        _connection.ServiceUri = new Uri("https://url");

        ClientCredentials credentials = new ClientCredentials();
        credentials.Windows.ClientCredential = new NetworkCredential("1","2","3"); 
        _connection.ClientCredentials = credentials;
        _connection.ClientCredentials.UserName.UserName = "1";
        _connection.ClientCredentials.UserName.Password = "2";
        _crmService = new XrmServiceContext(_connection);

       var l = _crmService.EntitySet.where(m => m.name == "a").ToList();
    }

What should I do to turn off caching?


Solution

  • Specify the service in your configuration file:

      <microsoft.xrm.client>   
        <services>
          <add name="Xrm" type="Microsoft.Xrm.Client.Services.OrganizationService, Microsoft.Xrm.Client"/>
        </services>
      </microsoft.xrm.client>