我正在努力成为“沙盒编辑器”
function getClonedWorkItem(entityType, entityId) {
var clonedManager = entityManager.createEmptyCopy();
var oentity = entityManager.getEntityByKey(_mapEntityTypeToSingleType(entityType), entityId);
//export it to the new manager
var exportData = entityManager.exportEntities([oentity], true);
clonedManager.importEntities(exportData);
var cloned = clonedManager.getEntityByKey(_mapEntityTypeToSingleType(entityType), entityId);
return {
entity: cloned,
__context: clonedManager
};
}
问题是克隆的项目在方面下没有extrametadata,所以我无法将其发送到服务器进行更新 - 因为它失败了
function updateDeleteMergeRequest(request, aspect, prefix) {
var extraMetadata = aspect.extraMetadata;
var uri = extraMetadata.uri || extraMetadata.id;
if (__stringStartsWith(uri, prefix)) {
uri = uri.substring(prefix.length);
}
request.requestUri = uri;
if (extraMetadata.etag) {
request.headers["If-Match"] = extraMetadata.etag;
}
}