/// <summary> /// Demonstrates a parallelized submission of multiple create requests with service proxy options /// 1. CallerId = The unique identifier of a systemuser being impersonated for the parallelized requests /// 2. ShouldEnableProxyTypes = Adds ProxyTypesBehavior to each OrganizationServiceProxy binding. Used for early-bound programming approach /// 3. Timeout = Increase the default 2 minute timeout on the channel to 5 minutes. /// </summary> /// <param name="targets">The list of target entities to create in parallel</param> /// <param name="callerId">The systemuser who should be impersonated for the parallelized requests</param> /// <returns>The collection of targets created with the assigned unique identifier</returns> public List <Entity> ParallelCreateWithOptions(List <Entity> targets, Guid callerId) { var options = new OrganizationServiceProxyOptions() { CallerId = callerId, ShouldEnableProxyTypes = true, Timeout = new TimeSpan(0, 5, 0) }; try { targets = this.Manager.ParallelProxy.Create(targets, options).ToList(); } catch (AggregateException ae) { // Handle exceptions } targets.ForEach(t => { Console.WriteLine("Created {0} with id={1}", t.LogicalName, t.Id); }); return(targets); }
public void InicializarPFE(Oracle ora) { Oracle = ora; Emr = new ExecuteMultipleRequest() { Settings = new ExecuteMultipleSettings() { ContinueOnError = true, ReturnResponses = true }, Requests = new OrganizationRequestCollection() }; var url = XrmServiceUriFactory.CreateOrganizationServiceUri(Comun.ConnStringCrm.Split(';')[0].Split('=')[1]); var usr = Comun.ConnStringCrm.Split(';')[1].Split('=')[1]; var pwd = Comun.ConnStringCrm.Split(';')[2].Split('=')[1]; OSManager = new OrganizationServiceManager(url, usr, pwd); OSOptions = new OrganizationServiceProxyOptions { Timeout = new TimeSpan(0, Comun.TimeOutEnMinutos, 0) }; PFERequests = new Dictionary <string, ExecuteMultipleRequest>(); RequestKey = 0; }