1, the problem put forward
in my last post (ArcGIS edits SDE’s vector data (set) (fixes versioning issues)) solved the unregistered uneditable problem of editing SDE in ArcGIS, and the same idea can be solved in ArcEngine. This is a relatively simple problem, so to make it longer, I’ve put together a post on my usual approach to solving the ArcEngine problem, skipping the second part if I’m in a hurry.
2. Solution </h2 b>
I have always believed that a problem the best solution for the first is to help document, the second is baidu Google, so in after already know how to solve the problems in ArcGIS can look up relevant content in the help document, we search “RegisterAsVersioned” in the help document, the following results were obtained:
This tells us that we should call the “IVersionedObject” interface, as ArcGIS always does, and of course the latest interface, IVersionedObject3.
we focus to the next object model diagram (installation under the path of ao), the interface is in ESRI ArcGIS. Geodatabase namespace, so you can open “GeoDatabaseObjectModel”, search IVersionedObject3, get this interface is here, this is an abstract class:
so we can to implement it like this: </ p>
IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;
The next steps for
are basically the same as in arcgis.
3. Code implementation: </h2 b>
I find a lot of information on the net, most of these code editing mode setting is not only the versioning patterns, but did not say how version, so, first to determine whether the data set is already registered version, if the registered version set directly edit mode without versioning editor, otherwise, you need to first register edition to edit. By this logic, the code should look like this:
if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
{
IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;
if (versionedObject != null && !versionedObject.IsRegisteredAsVersioned)
{
versionedObject.RegisterAsVersioned(true);
}
pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
}
//else
//{
// pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
//}
pEngineEditor.StartEditing(pWorkspace, pMap);
if you edit the sde data set update without a registered version, an error is reported: HRESULT:0x80040356
Read More:
- How to Fix IDM has been Registered with a Fake Serial Number
- How to Fix Sklearn ValueError: This solver needs samples of at least 2 classes in the data, but the data
- How many pieces of data can list store in Java?
- Analysis and solution of common errors in ArcEngine development
- How to Fix Parser rerror: error tokenizing data. C error: expected 2 fields in line 53, saw 3
- How to Fix The Latest Version of chrome cannot install the IDM plug-in IDMGCExt.crx
- How to Fix Error CGContextSetStrokeColorWithColor: invalid context 0x0
- UnhandledPromiseRejectionWarning Error: Can‘t set headers after they are sent (How to Fix)
- How to fix “Outlook data file cannot be accessed” error (Solved)
- How to Fix “the data of store is lost after Vue refreshes the page”
- [solved] win10 + office2016 error: library not registered, HResult: 0x8002801d
- How to Fix Warning: Statement lambda can be replaced with expression lambda
- error: a label can only be part of a statement and a declaration is not a statement (How to Fix)
- How to Fix TypeError: Cannot cast array data from dtype(‘float64‘) to dtype(‘<U32‘)….
- Could not write JSON: write javaBean error, fastjson version x.x.x, class
- How to Fix Error in module RSQL of the database interface
- How to Fix errors in Chinese input of latex
- ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)
- express nodejs Failed to lookup view error in views directory (How to Fix)
- How to use higher version of OpenGL SDK in windows?