3

crm 2011 缓存有问题。我不需要它,但我不知道如何禁用它。

首先我生成这个:

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

然后我有以下代码:

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

我应该怎么做才能关闭缓存?

4

2 回答 2

4

在配置文件中指定服务:

  <microsoft.xrm.client>   
    <services>
      <add name="Xrm" type="Microsoft.Xrm.Client.Services.OrganizationService, Microsoft.Xrm.Client"/>
    </services>
  </microsoft.xrm.client>
于 2011-11-29T16:44:16.160 回答
1

我发现另一个可以使用的旁路,它并不完美,人们可能会给我差评。

但是您始终可以使用始终随随机数或其他随机代码更改的查询:

Random r = new Random();
int rInt = r.Next(-100000000, 100000000);
var l = _crmService.EntitySet.where(m => m.name == "a" &&  m.name!=rInt.ToString()).ToList();
于 2015-07-22T08:12:02.563 回答