Hello everyone, I am need of your assistance.
I am unable to get object id for the Query Layer. I can get it for shapefile or sde feature class.
Please take a look at the sample code below.
Thank you,
Trushar Mistry
//--------------------------------------------------
// trusharm 2024-01-04 4:37pm, query layer GetDefinition() throws
// exception so we are unable to get field names, hence we cannot
// query layer at the moment until Esri fixes the issue
[NotNull]
private static string GetIdFieldForSpatialView([NotNull] FeatureLayer selectedFeatureLayer) =>
((CIMSqlQueryDataConnection)selectedFeatureLayer.GetDataConnection())
.OIDFields
.Contains("OBJECTID", StringComparison.InvariantCulture)
? "OBJECTID"
: throw new InvalidOperationException("The view must at least have OBJECTID as unique index");