Hi,
I'm trying to delete features from filegeodatabase feature class. After executing edit operation, features get deleted from attribute table but still appearing on Map.
I'm referring following code snippet : https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#deleting-a-rowfeature
Here is my sample code:
await QueuedTask.Run(() =>
{
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(Project.Current.DefaultGeodatabasePath))))
using (FeatureClass enterpriseTable = geodatabase.OpenDataset<FeatureClass>("PointFeature"))
{
EditOperation editOperationForPoints = new EditOperation();
editOperationForPoints.Callback(context =>
{
QueryFilter deleteFilter = new QueryFilter { WhereClause = $"OBJECTID NOT IN (27)" };
using (RowCursor rowCursor = enterpriseTable.Search(deleteFilter, false))
{
while (rowCursor.MoveNext())
{
using (Feature row = (Feature)rowCursor.Current)
{
context.Invalidate(row);
row.Delete();
}
}
}
}, enterpriseTable);
try
{
deletionResult = editOperationForPoints.Execute();
if (!deletionResult) message = editOperationForPoints.ErrorMessage;//"Edit operation failed."
}
catch (GeodatabaseException exObj)
{
message = exObj.Message;
}
}
});
.Execute() returning true value but ErrorMessage says "Edit operation failed."
Any help would be appreciated.
Prashant