I'm need to add rows that contain a FK into a primary table (wrapped by an ArcGISLocalFeatureLayer). When I add the row into the primary table, everything indicates success in the EndSaveEdits ... but sometimes the the Graphics collection still shows empty. Can someone offer some suggestions or insight?
theFeatureLayer.EndSaveEdits += (s2, endEditEventArgs) =>
{
// I observe that after adding a row, sometimes endEditEventArgs.Results.AddResults is 1 but theFeatureLayer.Graphics.Count is 0. Why is that and what can I do about it?
System.Diagnostics.Debug.Assert(theFeatureLayer == s2); // ok, as expected.
if (endEditEventArgs.Results.AddResults != null)
{
foreach (EditResultItem r in endEditEventArgs.Results.AddResults)
{
if (!r.Success)
{ // no problem here...
theLogger.WriteLine(String.Format("EndSaveEdits skipped item due to '{0}'", r.ErrorDescription));
continue;
}
// Fails b/c the Graphics collection is empty.
Graphic gr = theFeatureLayer.Graphics.Single(g => (int)g.Attributes["OBJECTID"] == (int)r.ObjectID);
if (gr != null)
{ // need to use the Graphic we just added. If only it were available....