Show / Hide Table of Contents

Method SwitchVersionAsync

SwitchVersionAsync(String, CancellationToken)

Asynchronously switches all connected feature tables to the new version.

Declaration
public Task SwitchVersionAsync(string versionName, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String versionName

The name of the version to connect to.

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken with which to cancel the operation if required.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the switching to the specified version.

Remarks

An error is thrown if:

  • The service isn't branch versioned.
  • No version exists with the supplied name.
  • Any of the ConnectedTables have unapplied edits.

Check the result of HasLocalEdits() before attempting to switch versions, to make sure all changes are saved to the service or discarded from the local cache. Use the ServiceGeodatabase.ApplyEditsAsync(), ServiceGeodatabase.ApplyEditsAsync(CancellationToken) or ServiceGeodatabase.UndoLocalEditsAsync() methods as appropriate to save or discard changes before switching versions.

Exceptions
Type Condition
System.ArgumentNullException

versionName is null.

ArcGISRuntimeException

No version exists with the supplied name.

System.InvalidOperationException

Any of the ConnectedTables have unapplied edits.

BranchVersioningNotSupportedByServiceException

The service isn't branch versioned.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.12 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.2 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.12 - 200.7
Xamarin.Android100.12 - 100.14
Xamarin.iOS100.12 - 100.15
UWP100.12 - 200.7

SwitchVersionAsync(String)

Asynchronously switches all connected feature tables to the new version.

Declaration
public Task SwitchVersionAsync(string versionName)
Parameters
Type Name Description
System.String versionName

The name of the version to connect to.

Returns
Type Description
System.Threading.Tasks.Task

A task that represents the switching to the specified version.

Remarks

An error is thrown if:

  • The service isn't branch versioned.
  • No version exists with the supplied name.
  • Any of the ConnectedTables have unapplied edits.

Check the result of HasLocalEdits() before attempting to switch versions, to make sure all changes are saved to the service or discarded from the local cache. Use the ServiceGeodatabase.ApplyEditsAsync(), ServiceGeodatabase.ApplyEditsAsync(CancellationToken) or ServiceGeodatabase.UndoLocalEditsAsync() methods as appropriate to save or discard changes before switching versions.

Exceptions
Type Condition
System.ArgumentNullException

versionName is null.

ArcGISRuntimeException

No version exists with the supplied name.

System.InvalidOperationException

Any of the ConnectedTables have unapplied edits.

BranchVersioningNotSupportedByServiceException

The service isn't branch versioned.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.10 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.0 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.10 - 200.7
Xamarin.Android100.10 - 100.15
Xamarin.iOS100.10 - 100.15
UWP100.10 - 200.7
In This Article
Back to top Copyright © 2022 Esri.