Select to view content in your preferred language

"Objects in this object class cannot be updated outside of an edit session." Error on Creating Annotation

669
3
04-17-2023 12:20 AM
MatsHardy
Occasional Contributor

I have a point feature class A in file gdb and then I created a feature-linked annotation class B.

Then I have made a SDK program to create annotation on B, the program work fine on file gdb. But I copied both A & B to geodatabase on SQL Server, the program failed, 'Objects in this object class cannot be updated outside of an edit session.' is shown.

I found that the error occurred on the code below:

RowBuffer annoBuf = annoFC.CreateRowBuffer();
Feature anFt = annoFC.CreateRow(annoBuf);
AnnotationFeature annoFt = (AnnotationFeature)anFt;

Do anyone have ideas?

0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You need to use EditOperation to work with enterprise geodatabase. Sample here:

https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Editing-Annotation#creating-annotation-featu... 

MatsHardy
Occasional Contributor

Many thx, but my annotation program is a standalone program rather than ArcGIS Pro add-in. How can I add the EditorOperation and inspector objects to my program? Besides, how can I implement desktop objects e.g. inspector, CurrentTemplate in standalone program?

0 Kudos
GKmieliauskas
Esri Regular Contributor

For stand-alone CoreHost applications, calls to editing methods should be enclosed within a call to Geodatabase.ApplyEdits.

Sample here:

CreateInsertCursor Method—ArcGIS Pro

0 Kudos