I have a concurrent program to request crm, and then I found that the DisableCrossThreadSafeties property setting of CrmServiceClient supports concurrency, and found that setting it to true increases the concurrency efficiency by 50%. Is there any risk to crm or thread safety issues?
CrmServiceClient svc = new CrmServiceClient(ConfigurationManager.AppSettings["ConnStr"]);
svc.DisableCrossThreadSafeties = true;
Set to false: the total time-consuming program runs to completion, time-consuming: 164930 list count: 320 average each millisecond: 515
Set to true Total time-consuming program to run to completion, time-consuming: 79941 list count: 320 average each millisecond: 249
Hi,
CrmServiceClient itself is thread safe, but if you use DisableCrossThreadSafeties, it will cause thread safety issues.
You can refer to the official API documentation, here is a very clear statement:
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Frank Gong
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,867 Super User 2024 Season 2
Martin Dráb 229,173 Most Valuable Professional
nmaenpaa 101,156