سؤال

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?

هل كانت مفيدة؟

المحلول

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>

نصائح أخرى

Another bypass I found which can be used, its not perfect and people might give me bad reviews.

But you can always use a query which always changes with a random number or other random code:

Random r = new Random();
int rInt = r.Next(-100000000, 100000000);
var l = _crmService.EntitySet.where(m => m.name == "a" &&  m.name!=rInt.ToString()).ToList();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top