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
<SPAN class="keyword token">var</SPAN> geoBeforeEdit <SPAN class="operator token">=</SPAN> feature<SPAN class="punctuation token">.</SPAN>Geometry<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> editGeometry <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> mapControlView<SPAN class="punctuation token">.</SPAN>SketchEditor<SPAN class="punctuation token">.</SPAN><SPAN class="token function">StartAsync</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>Geometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
feature<SPAN class="punctuation token">.</SPAN>Geometry <SPAN class="operator token">=</SPAN> editGeometry<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> feature<SPAN class="punctuation token">.</SPAN>FeatureTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">UpdateFeatureAsync</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
IReadOnlyList<SPAN class="operator token"><</SPAN>EditResult<SPAN class="operator token">></SPAN> editResults <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> <SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>FeatureTable <SPAN class="keyword token">as</SPAN> ServiceFeatureTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">ApplyEditsAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Any</SPAN><SPAN class="punctuation token">(</SPAN>r <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> r<SPAN class="punctuation token">.</SPAN>CompletedWithErrors <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
XHNotifyIcon<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ShowFancyBalloon</SPAN><SPAN class="punctuation token">(</SPAN>editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Where</SPAN><SPAN class="punctuation token">(</SPAN>r <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> r<SPAN class="punctuation token">.</SPAN>CompletedWithErrors <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">Aggregate</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">.</SPAN>Empty<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>current<SPAN class="punctuation token">,</SPAN> o<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="string token">"Edit to Object '"</SPAN> <SPAN class="operator token">+</SPAN> o<SPAN class="punctuation token">.</SPAN>ObjectId <SPAN class="operator token">+</SPAN> <SPAN class="string token">"' failed: "</SPAN> <SPAN class="operator token">+</SPAN> o<SPAN class="punctuation token">.</SPAN>Error<SPAN class="punctuation token">.</SPAN>Message <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n\r"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">bool</SPAN> isSuccess <SPAN class="operator token">=</SPAN> <SPAN class="comment token">//do something else.....</SPAN>
<SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>isSuccess <SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
feature<SPAN class="punctuation token">.</SPAN>Geometry <SPAN class="operator token">=</SPAN> geoBeforeEdit<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> feature<SPAN class="punctuation token">.</SPAN>FeatureTable<SPAN class="punctuation token">.</SPAN><SPAN class="token function">UpdateFeatureAsync</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
IReadOnlyList<SPAN class="operator token"><</SPAN>EditResult<SPAN class="operator token">></SPAN> editResults <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> <SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">.</SPAN>FeatureTable <SPAN class="keyword token">as</SPAN> ServiceFeatureTable<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">ApplyEditsAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Any</SPAN><SPAN class="punctuation token">(</SPAN>r <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> r<SPAN class="punctuation token">.</SPAN>CompletedWithErrors <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
XHNotifyIcon<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ShowFancyBalloon</SPAN><SPAN class="punctuation token">(</SPAN>editResults<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Where</SPAN><SPAN class="punctuation token">(</SPAN>r <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> r<SPAN class="punctuation token">.</SPAN>CompletedWithErrors <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">Aggregate</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">.</SPAN>Empty<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>current<SPAN class="punctuation token">,</SPAN> o<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="string token">"Edit to Object '"</SPAN> <SPAN class="operator token">+</SPAN> o<SPAN class="punctuation token">.</SPAN>ObjectId <SPAN class="operator token">+</SPAN> <SPAN class="string token">"' failed: "</SPAN> <SPAN class="operator token">+</SPAN> o<SPAN class="punctuation token">.</SPAN>Error<SPAN class="punctuation token">.</SPAN>Message <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n\r"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>