简体   繁体   English

Dynamics CRM Web API批量

[英]Dynamics CRM Web API Bulk

All, 所有,

I have a C# program that is able to send data to a CRM system (by using the Web API through HTTP Post requests). 我有一个能够将数据发送到CRM系统的C#程序(通过HTTP Post请求使用Web API)。 However, amount of requests that I have to perform is in the order of 10000's on daily basis which as expected takes a huge amount of time to complete. 但是,我必须执行的请求数量每天大约为10000,这与预期相比需要花费大量时间才能完成。 I've been looking at a "bulk" functionality where I would be able to send a large amount of data at once (say 10000 task objects at once). 我一直在寻找一个“批量”功能,我可以一次发送大量数据(比如一次发送10000个任务对象)。 For one reason or another I can't find such functionality being implemented, the closest I've gotten is "batch requests" though by the example provided it looks like multiple requests wrapped in a single http post request, which, i am not quite sure would be the best solution for having generated 10000 post requests wrapped in a single such one unless this is the only way to do it 由于某种原因,我找不到实现这样的功能,我得到的最接近的是“批量请求”,但是通过示例提供它看起来像是在单个http post请求中包含的多个请求,我不太满意确定将生成10000个帖子请求包装在一个这样的一个中的最佳解决方案,除非这是唯一的方法

So, is there a bulk functionality or is the batch requests the best I have to deal with? 那么,是否有批量功能或批量请求是我必须处理的最好的?

You are correct, the batching won't help you much since all of your requests will still be processed sequentially. 您是对的,批处理对您没有多大帮助,因为您的所有请求仍将按顺序处理。 For that volume of data, you need to implement concurrency/parallelism/multi-threading. 对于该数据量,您需要实现并发/并行/多线程。 The integration guy on my project has been able to achieve about 100 operations per second on average using what is essentially a producer/consumer pattern. 我的项目中的集成人员平均使用基本上是生产者/消费者模式的平均每秒约100次操作。 He uses an auto-growing pool of CRM connections and as soon as one request is finished processing, the connection is returned to the pool. 他使用自动增长的CRM连接池,只要一个请求完成处理,连接就会返回到池中。

The Microsoft Premier Field Engineering team publishes the PFE Core Library for Dynamics CRM on CodePlex. Microsoft Premier Field Engineering团队在CodePlex上发布了针对Dynamics CRMPFE核心库 The library has a ParallelOrganizationServiceProxy class that should do a lot of the complicated concurrency work for you. 该库有一个ParallelOrganizationServiceProxy类,它应该为您执行许多复杂的并发工作。 Here's an example: 这是一个例子:

public void ParallelUpdate(List<Entity> targets)
{
    try
    {
        this.Manager.ParallelProxy.Update(targets);
    }
    catch (AggregateException ae)
    {
        // Handle exceptions
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM