Domanda

Ho problemi con CRM 2011 caching. Non ho bisogno, ma non so come disabilitarlo.

Per prima cosa ho generare questo:

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

allora ho il seguente codice:

   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();
    }

Cosa devo fare per disattivare la cache?

È stato utile?

Soluzione

Specifica il servizio nel file di configurazione:

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

Altri suggerimenti

Un altro bypass che ho trovato che può essere usato, la sua non perfetta e la gente mi potrebbe dare recensioni negative.

Ma si può sempre utilizzare una query che cambia sempre con un numero casuale o altro codice casuale:

Random r = new Random();
int rInt = r.Next(-100000000, 100000000);
var l = _crmService.EntitySet.where(m => m.name == "a" &&  m.name!=rInt.ToString()).ToList();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top