Hi,
I want to rollback an Edit since last UpdateFeatureAsync an ApplyEditsAsync(just geometry), so I give the feature the old geometry then UpdateFeatureAsync an ApplyEditsAsync, but it seems can't apply to server database the second time and with no EditResults(count=0) return, Below is my codes
var geoBeforeEdit = feature.Geometry;
var editGeometry = await mapControlView.SketchEditor.StartAsync(feature.Geometry);
feature.Geometry = editGeometry;
await feature.FeatureTable.UpdateFeatureAsync(feature);
IReadOnlyList<EditResult> editResults = await (feature.FeatureTable as ServiceFeatureTable).ApplyEditsAsync();
if (editResults.Any(r => r.CompletedWithErrors == true))
{
XHNotifyIcon.ShowFancyBalloon(editResults.Where(r => r.CompletedWithErrors == true).Aggregate(string.Empty, (current, o) => "Edit to Object '" + o.ObjectId + "' failed: " + o.Error.Message + "\n\r"));
return false;
}
bool isSuccess =
if(!isSuccess )
{
feature.Geometry = geoBeforeEdit;
await feature.FeatureTable.UpdateFeatureAsync(feature);
IReadOnlyList<EditResult> editResults = await (feature.FeatureTable as ServiceFeatureTable).ApplyEditsAsync();
if (editResults.Any(r => r.CompletedWithErrors == true))
{
XHNotifyIcon.ShowFancyBalloon(editResults.Where(r => r.CompletedWithErrors == true).Aggregate(string.Empty, (current, o) => "Edit to Object '" + o.ObjectId + "' failed: " + o.Error.Message + "\n\r"));
return false;
}
}