参考原文:
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/bulk-operations?tabs=sdk
总结版本
一次只能批量创建/更新同一个实体的不同记录,不同的还是得走多个。
upsert是个丑东西。
CreateMultipleRequest createMultipleRequest = new() { Targets = entities, };
service.CreateMultiple(createMultipleRequest)
UpdateMultipleRequest updateMultipleRequest = new() { Targets = entities, };
service.UpdateMultiple(updateMultipleRequest )
UpsertMultiple
service.Create(new Entity(tableLogicalName) { Attributes = { {altKeyColumnLogicalName, "Record For Update"}, {"samples_description","A record to update using Upsert" } } }); // Using the Entity constructor to specify alternate key Entity toUpdate = new( entityName: tableLogicalName, keyName: altKeyColumnLogicalName, // Same alternate key value as created record. keyValue: "Record For Update"); toUpdate["samples_description"] = "Updated using Upsert"; Entity toCreate = new( entityName: tableLogicalName, keyName: altKeyColumnLogicalName, keyValue: "Record For Create"); toCreate["samples_description"] = "A record to create using Upsert"; // Add the records to a collection EntityCollection records = new() { EntityName = tableLogicalName, Entities = { toUpdate, toCreate } }; // Send the request UpsertMultipleRequest request = new() { Targets = records }; var response = (UpsertMultipleResponse)service.Execute(request);
标签:service,批量,tableLogicalName,Entity,records,samples,new,Dynamics,365 From: https://www.cnblogs.com/RegularMoon/p/18383174/D365BulkOp