Use branch versioned data
Use branch versioned data (a type of enterprise geodatabase versioning) when you want to provide multiuser editing in a service-oriented architecture (through feature services) and your users don't need direct access to the geodatabase. To compare versioning types, see ArcGIS Pro's topic Versioning types.
With branch versioning, editors can work within their own personal version of a geodatabase so that other users don't see incomplete work and editors don't block one another from accessing the data. Each version can represent ongoing work, such as a design or a group of work orders, work that can span multiple sessions and extend over a period of weeks or months if necessary.
Some common workflows for using branch versioned datasets include:
- Multiuser editing, such as individual field crews working in their own branches
- Modeling a variety of outcomes, with each scenario represented in its own branch
- Editing and tracking different phases of a project
To use branch versioning in your app:
- The data must be set up and shared as described in the Set up and share versioned data section.
- You bring the data into your app using the
ServiceGeodatabaseclass, as described in the Work with branch versions section.
Branched versioned data can be edited offline the same way you edit feature services offline or use individual layers offline, as described in the Edit data from a branch version section.
If you require multiple editors concurrently accessing services with the ability to work with their own set of edits, you must first register your data as branch versioned. When you share that dataset as a service, you have the option to enable the Version Management capability at the time of publishing, which allows for the creation and management of versions. For more information about setting up a database with branch versioning, see ArcGIS Pro Help's Register a dataset as branch versioned.
To edit branch versioned data, you must access it through a feature service. After registering data as branch versioned, publish the data to your organization's ArcGIS Enterprise portal as a web feature layer. Be sure you publish a layer that references registered data. The data will then be available as a feature service and you can edit it as part of your branch versioning workflows. For more information about how to share branch versioned data, see ArcGIS Pro help's Share branch versioned data.
In ArcGIS Runtime, use the
ServiceGeodatabase class to represent a hosted geodatabase. You can create an instance of the class by providing the service URI and optionally the version name. You can also read the
ServiceGeodatabase property from a service feature table.
ServiceFeatureTable will have an associated
ServiceGeodatabase if the feature table was loaded from a web map or if it was created from a service geodatabase (using ). A standalone service feature table, created using any of the constructors, will not have access to a service geodatabase.
The service geodatabase allows you to manage edits for all tables it contains, such as checking if the service geodatabase has local edits, applying all edits, or undoing all local edits. Such operations affect all tables in the service geodatabase's connected tables (the collection of feature tables it manages) and apply to all types of edits (add or delete features, update a feature's geometry or attribute values, edit attachments, and so on). Additionally, when the service geodatabase supports branch versioning, you can read the available versions for the geodatabase, switch the current version, or create a new version.
Use to get information about the versions a service geodatabase contains that the current user has access to. The information includes the name, description, access level (private, protected, or public), creation date, and so on. You can create a new version by providing a name, description, and access level. You can access public and protected versions, and private versions you own. You cannot see information about, or connect to, private versions owned by other users.
The following steps show some common tasks when working with versions in a service geodatabase. These include getting the service geodatabase used by a feature layer, getting information about the current version, creating a new version, and switching the version used by the geodatabase to the new one.
Get the service feature table from a feature layer in the map.
Get the service geodatabase from the service feature table. Make sure the service geodatabase is loaded. Loading the service feature table will also load its service geodatabase.
See if the service geodatabase supports branch versioning. If it does, get a list of its versions and information about the current version.
Create service version parameters that define properties for a new version: a name, description, and access level.
Pass the parameters to the service geodatabase to create a new version. Then switch the current version of the database to the new one.
Edits can be made to service feature tables from a branch version in the same way they are made to any service feature table. You can use the same workflow described in the [Edit]../edit/) topic. Within that standard workflow, the
ServiceGeodatabase class provides some additional members for managing edits. For example, all local edits (to all tables in the version) can be applied by calling and you can undo all edits with . Reconciling and posting versions are back-office operations that should be performed with ArcGIS Pro or other enterprise processes.
Make edits to feature tables, such as adding, deleting, or updating features. Edits to attachments and adding or removing relates can also be managed by the service geodatabase.
Feature table edits only affect the local datasets unless they are explicitly applied to the service. Before applying your local edits, you may want to examine the connected tables for a service geodatabase to see which tables it manages. When loading a web map, the service geodatabase's connected tables will consist of all tables in the map from the same feature service. Accessing a table from the service geodatabase (using ) will also add that table to the collection of connected tables.
You can apply edits back to the feature service for each table individually or, if the datasets come from a service geodatabase, for all local edits on all connected tables in the service geodatabase. You can use on a service feature table or service geodatabase to see if there are unsaved local edits.
The advantage of calling on the service geodatabase rather than on each individual table is that it ensures that all of the edit operations take place in a single transaction. Either all of the edits are applied or none of them. If you apply edits on each table individually, it is possible that only some edits will be applied (for example, if you lose network connectivity in the middle of the operation).
You can also undo local edits for each table individually or for all local edits on all connected tables in the service geodatabase.