ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Core Namespace / EditingProjectExtender Class / SetSingleEditWorkspaceAsync Method / SetSingleEditWorkspaceAsync(Project,DatastoreConfiguration) Method
The datastore configuration to edit.
Example

In This Topic
    SetSingleEditWorkspaceAsync(Project,DatastoreConfiguration) Method
    In This Topic
    Start a single edit workspace session using the specified datastore configuration.
    Syntax
    public static Task<bool> SetSingleEditWorkspaceAsync( 
       Project project,
       DatastoreConfiguration datastoreConfig
    )
    Public Overloads Shared Function SetSingleEditWorkspaceAsync( _
       ByVal project As Project, _
       ByVal datastoreConfig As DatastoreConfiguration _
    ) As Task(Of Boolean)

    Parameters

    project
    datastoreConfig
    The datastore configuration to edit.

    Return Value

    A task representing a value indicating if the edit session was started.
    Exceptions
    ExceptionDescription
    The project is not configured for editing single workspaces.
    A workspace is already being edited and has pending edits. Save or discard these edits first.
    A workspace is already being edited. Stop editing this workspace first.
    Remarks
    This method can only be used when EditingOptions.EnableEditingFromEditTab and EditingOptions.IsSingleWorkspaceEditSession are true. If the settings are not set then an System.InvalidOperationException will be thrown.

    Use this method for editing an enterprise geodatabase, particularly when the geodatabase has a mixture of versioned and non-versioned datasets. Explicitly set the ArcGIS.Core.Data.DatastoreConfiguration.VersionState to specify the datasets that will be edited.

    Example
    Start a Single workspace edit session via a DatastoreConfiguration
    // setup the configuration to edit the data registered as versioned in the egdb
    var datastoreConfig = new DatastoreConfiguration(egdb, VersionState.Versioned);
    
    // start the edit session on the workspace
    var project = Project.Current;
    var v_success = await project.SetSingleEditWorkspaceAsync(datastoreConfig);
    
    // OR 
    
    // setup the configuration to edit the data that is not registered as versioned
    var nonVersionedDatastoreConfig = new DatastoreConfiguration(egdb, VersionState.NonVersioned);
    // start the edit session on the workspace
    var nv_success = await project.SetSingleEditWorkspaceAsync(nonVersionedDatastoreConfig);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also