2011-11-29 64 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();