2011-11-29 50 views
2

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

首先我生成这样的:

CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration” /输出:Outputcs /URL: HTTPS://crmaddress/XRMServices/2011/Organization.svc /用户名:USR /密码:PW /命名空间: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

在配置文件中指定的服务:

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

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

但是你可以使用查询总是与一个随机数或其他随机代码更改:

Random r = new Random(); 
int rInt = r.Next(-100000000, 100000000); 
var l = _crmService.EntitySet.where(m => m.name == "a" && m.name!=rInt.ToString()).ToList();