AnsweredAssumed Answered

ArcGIS Pro SDK for .NET points to the old FeatureClass after changing Data Source of FeatureLayer

Question asked by ave.vill_CGI on Mar 11, 2019
Latest reply on Mar 23, 2020 by UHarano-esristaff

Hi, Esri Technical Support


I am using ArcGIS Pro SDK for .NET version


Based on community sample ChangeLayerDataSource.cs I have implemented Data Source change functionality using SetDataConnection method.


Everything works fine except the cases when WorkspaceFactory changes from FileGDB to SDE or the other way around, from SDE to FileGDB. After setting the new Data Connection, the new parameters are attached to the featureLayer, but when reading the layers again with MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>(), the featureLayer.GetFeatureClass() shows the old FeatureClass. After closing/saving and reopening the project the FeatureClass is updated and SDK shows it correctly with featureLayer.GetFeatureClass().


Has anyone had a similar issue and is there a way to refresh FeatureClass programmatically to be used in SDK?


Thanks in advance,