public VersionBaseType GetCurrentVersionBaseType()
Public Function GetCurrentVersionBaseType() As VersionBaseType
Return Value
The type of VersionBase of the current Version.
VersionManager
belongs to a Geodatabase that is connected to a Version or a HistoricalVersion.public VersionBaseType GetCurrentVersionBaseType()
Public Function GetCurrentVersionBaseType() As VersionBaseType
Exception | Description |
---|---|
ArcGIS.Core.Data.Exceptions.GeodatabaseVersionException | The current VersionBase is invalid. |
ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
public void ChangeVersions(Geodatabase geodatabase, string toVersionName) { using (VersionManager versionManager = geodatabase.GetVersionManager()) { VersionBaseType versionBaseType = versionManager.GetCurrentVersionBaseType(); if (versionBaseType == VersionBaseType.Version) { Version fromVersion = versionManager.GetCurrentVersion(); Version toVersion = versionManager.GetVersion(toVersionName); // Switch between versions MapView.Active.Map.ChangeVersion(fromVersion,toVersion); } if (versionBaseType == VersionBaseType.HistoricalVersion) { HistoricalVersion fromHistoricalVersion = versionManager.GetCurrentHistoricalVersion(); HistoricalVersion toHistoricalVersion = versionManager.GetHistoricalVersion(toVersionName); // Switch between historical versions MapView.Active.Map.ChangeVersion(fromHistoricalVersion, toHistoricalVersion); } // Switch from HistoricalVersion to Version and vice-versa // MapView.Active.Map.ChangeVersion(fromHistoricalVersion, toVersion); // MapView.Active.Map.ChangeVersion(fromVersion, toHistoricalVersion); } }
Target Platforms: Windows 11, Windows 10, Windows 8.1