gkar68

Access attributes of a deleted feature

Discussion created by gkar68 on Apr 3, 2013
I am migrating code for an ArcGIS extension from 9.3 to 10.1.
The code is throwing an exception in one place.

My duty is just to migrate it to 10.1, so I really don't like to do any modification more than few lines of code.

The code is searching for a feature that was deleted by the user on a child version,
but
1 - it is not posted yet to the default version
2 - The edit session is still open and not saved.

so before the save it is trying to validate some business rules.

the code is like this
 
IFeatureWorkspace childWorkspace = (IFeatureWorkspace)childVersion;
    IFeatureClass childOperationalUnit = childWorkspace.OpenFeatureClass("OperationUnit");
    IFeature childFeature = childOperationalUnit.GetFeature(Id_Of_Deleted_Feature);
    if (childFeature != null)
    {
     string operationName = childFeature.get_value(Index_Of_Name_Column); 

    if (operationName == "somevalue")
    ......
    }
 


So, the code is trying to access the attributes of a deleted feature.
The code was working on 9.3

But on 10.1 is not working and giving me the error:

System.Runtime.InteropServices.COMException (0x8004100C): The feature is deleted
The error happening on the line where we try to get the attributes of the feature with get_value

so, 10.1 can find the feature but cannot access its attributes.
is there any easy way to keep the code working without really modifying lots of code?

Outcomes