Select to view content in your preferred language

Feature Service is not associated with a feature table

789
1
08-09-2017 06:20 AM
PatricioQuispe_Sosa
New Contributor

Hi, I´m using the latest version of Arcgis SDK for .NET in a wpf app. I developed a user control which interacts with map and feature services, I'm able to create features in the user control and returning them to the wpf app where I call a method (SyncFeatures) that adds/updates the features received from the user control. Inside method SyncFeatures I add some attributes to the features like this

pObjResultadoRegistroDomiciliario.FeatureDomicilioPersona.SetAttributeValue("usuario", pUsuario);

when that line is executed i get an InvalidOperationException "Cannot call this method in this context: Feature Service is not associated with a feature table". 

Debugging I found that "FeatureDomicilioPersona" has a property FeatureTable which is a ServiceFeatureTable, when I receive the feature from the user control the property FeatureDomicilioPersona.FeatureTable has content: 


but when I send the feature to the SyncFeatures method that property magically disappears:

Having the property FeatureTable set to null is the reason for the exception I get.

I followed the examples and guides for the sdk but I´m not able to find the reason for that behavior

Is there something I missing? 

Thanks for your help!

0 Kudos
1 Reply
NagmaYasmin
Esri Contributor

Hi, 

First you need to load all the fields of the ServiceFeatureTable using  QueryFeatureFields.LoadAll and then call SetAttributeValue() method.. By default, it loads only the minimum fields and I believe that causes the error.

 FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams, QueryFeatureFields.LoadAll);

I tried at my side and I don't get the error anymore, otherwise I do get the same error. 

Hope that helps.

Nagma

0 Kudos