在更新 Dynamics CRM 365 Online 实体之前是否必须检索
Do you have to retrieve before you update a Dynamics CRM 365 Online entity
通常需要更新实体的代码就是这样。 (帐户中的列可能不存在,这只是为了说明)
Entity someEntity = new Entity("account");
Guid accountId = "[GUID that you already have from another query]";
ColumnSet attributes = new ColumnSet(new string[] { "name", "address" });
someEntity = organizationProxy.Retrieve(someEntity.LogicalName, accountId, attributes);
someEntity["name"] = "Mister";
someEntity["address"] = "XYZ";
organizationProxy.Update(someEntity);
这似乎有点浪费,如果我要更新 5000 条记录,我必须查询数据库以获取对实体的引用然后更新它。有没有办法,因为我已经有了记录 GUID 来创建实体对象然后更新它?类似...
Entity someEntity = new Entity("account");
someEntity["accountid"] = accountId;
someEntity["name"] = "Mister";
someEntity["address"] = "XYZ";
organizationProxy.Update(someEntity);
提前致谢。
更新前无需检索。立即进行更新,例如使用问题最后一部分的代码。
通常需要更新实体的代码就是这样。 (帐户中的列可能不存在,这只是为了说明)
Entity someEntity = new Entity("account");
Guid accountId = "[GUID that you already have from another query]";
ColumnSet attributes = new ColumnSet(new string[] { "name", "address" });
someEntity = organizationProxy.Retrieve(someEntity.LogicalName, accountId, attributes);
someEntity["name"] = "Mister";
someEntity["address"] = "XYZ";
organizationProxy.Update(someEntity);
这似乎有点浪费,如果我要更新 5000 条记录,我必须查询数据库以获取对实体的引用然后更新它。有没有办法,因为我已经有了记录 GUID 来创建实体对象然后更新它?类似...
Entity someEntity = new Entity("account");
someEntity["accountid"] = accountId;
someEntity["name"] = "Mister";
someEntity["address"] = "XYZ";
organizationProxy.Update(someEntity);
提前致谢。
更新前无需检索。立即进行更新,例如使用问题最后一部分的代码。