I'm trying to add new features to a Featurelayer. This only seems to work if I get the featurelayer from the map. Is there a way to add features without having to get the layers from the map first?
This is the code I tried, that fails (without any error btw, it just does nothing):
FeatureLayer layer = new FeatureLayer();
layer.Url = myLayerUrl;
layer.AutoSave = false;
Graphic feature = new Graphic();
feature.Geometry = myGeometry;
feature.Attributes.Add("SUMMARY", "hardcoded description 1000");
layer.Graphics.Add(feature);
layer.SaveEdits();
I tried calling layer.Inititalize(), but this doesn't seem to do anything either. Maybe I'm missing something here. Is the only way to connect a Featurelayer object to a featureservice to get it from Map.Layers?
I don't want to do this, because not all my tables have to be visible in the map. Also it makes it harder to decouple UI from business objects if i need the Map object everywhere in my application.
Maybe there is another way to get to the featureservice? I can't find any documentation about this.