Issue editing features in a geodatabase using the corehost dlls in a console application

343
5
Jump to solution
02-25-2020 07:18 AM
LarsDomesjö
New Contributor III

Hello,

I am somewhat new to ArcGIS Pro and am in the process of developing a console application using the CoreHost dlls.

Everything has been going smoothly overall so far but I have now run into an issue I would like to ask this fine community about

I've been developing a console application which is creating a geodatabase based on information coming in via XML-files which i am parsing to Features and Shapes.

Creating the geodatabase from scratch was not a problem and it was filled with all 8M features coming in from the XML-files.

Now I want to do another run against the geodatabase to update the features which has changed since I first created the geodatabase and the ArcGIS SDK now suddenly wants me to create an EditOperation for me to be able to update the features?

The EditOperation does not seem to be part of the CoreHost dlls and seem to require the Desktop dlls? Do I really need to drag in all the Desktop dlls just to be able to edit a geodatabase?

The exact error message I am getting is "The current operation requires an edit operation"

Best regards

Lars

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

Lars,

That error message isn't clear at all.  The Geodatabase.Evaluate method uses a QueryDef object to create a virtual table.  QueryDefs can reference multiple tables, but the resulting virtual table cannot be edited.  

Could you create your cursor by calling Table.Search() instead?  This uses what is called a QueryFilter, which can only reference a single table, and is editable.  This is the typical pattern used for editing data.

--Rich

View solution in original post

5 Replies
RichRuh
Esri Regular Contributor

Hi Lars,

When editing with CoreHost, you should create an edit operation using Geodatabase.ApplyEdits().  More details are written up .

I hope this helps,

--Rich

LarsDomesjö
New Contributor III

Hello Rich Ruh and Sean Jones , thanks for the quick replies!

I did try ApplyEdits at one point but ended up with the same issue, this is what I am currently running with:

0 Kudos
RichRuh
Esri Regular Contributor

Lars,

That error message isn't clear at all.  The Geodatabase.Evaluate method uses a QueryDef object to create a virtual table.  QueryDefs can reference multiple tables, but the resulting virtual table cannot be edited.  

Could you create your cursor by calling Table.Search() instead?  This uses what is called a QueryFilter, which can only reference a single table, and is editable.  This is the typical pattern used for editing data.

--Rich

LarsDomesjö
New Contributor III

Ah, that explains the issue I was having, switched to Table.Search() and now it's working perfectly, thanks alot for the assistance Rich Ruh‌!

SeanJones
Esri Regular Contributor