I want to be able to add features to a Feature Class but not have to add that Feature Class to the map. Currently the snippets I see require that.
Any advice on how to do it?
here is the code to do it. The caveat here is that this approach is not recommended for versioned data.
string gdbPath = CoreModule.CurrentProject.DefaultGeodatabasePath;
Geodatabase gdb = new Geodatabase(gdbPath);
var featureClass = gdb.OpenDataset<FeatureClass>("Sample");
var featureBuffer = featureClass.CreateRowBuffer();
var newFeature = featureClass.CreateRow(featureBuffer) as Feature;
Thanks for that. We did try something like that but we got some Not on this thread errors.
That's probably us as we added it to an existing synchronous codebase. What we'll do in future is have a test project that does simple things in the async world. Once that is working so we know what we are doing is Ok; we can then try and get it to run synched.
We do have snippets for creating a feature from given an sde file path. You can find it here https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#creating-a-feature.
It is recommended that edits have to be performed within the EditOperation. This allows for editing versioned/non-versioned data with undo/redo/discard/abort capabilities wherever required. Please see https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProConcepts-Editing#performing-edits for more details.
Thanks. Your links did not work but they did give me the clue to find them myself.
It would be nice if the snippets were more prominent on the web site.