When working with Sitecore in a team with more developers, you can either use a shared database or solve the synchronization of Sitecore items among developers in some way.

Shared Database

The easiest solution available is using a shared database somewhere on a network disk and all developers can develop at the same time above the current Sitecore items.

However, this solution has several fundamental drawbacks:

  • The DB does not always have to be accessible. You cannot work from another location, where the DB is not available.
  • The developer can mutually overwrite items under their hands if they are developing a common functionality.
  • You are working with the least stable version. Oftentimes, you can come across a situation, when after changing some important items, the web or a part of it will stop working, until another developer completes the development and you download his commit from the version control system.

Synchronization Using Packages

If every developer is to maintain his own database, the problem of how to keep the database updated in order for changes made by other developers to reflect in your database arises. In this case, you can use package designer and install the package of other developers so that they are in compliance with the code, which you download from the version control system.

This method is very inconvenient and hard to maintain for more intensive development. Oftentimes it will be necessary to download the packages from more stable environments in order to correct the inconsistencies.

Synchronization Tool Using Serialization

Fortunately, there are solid commercial and open source solutions for team cooperation, which solves this problem. The principle lies in using serialization of Sitecore items on a disk. In comparison with the version in the version control system, you can decide, which version is correct and either replace an item in your Sitecore database or commit a change in the serialized item in the version control system for other developers.

By sharing serialized items, you ensure that the whole team uses the same Sitecore items without the need to complicate the creation and installation of packages.

Team Development for Sitecore

The most popular commercial solution is Team Development for Sitecore (TDS). It is a plug-in into Visual Studio, where a new project in solution is created for every configuration synchronization, in which it maintains a tree with serialized Sitecore items.

Team Development for SitecoreThe typical TDS uses at least two projects, one for core and the other for master DB. Synchronization takes place via a web service with a library (Sitecore connector), which installs the TDS in a Sitecore instance. By running the synchronization, serialization of the item from the database onto the disk takes place followed by a comparison with the files it already manages. The user consequently sees a synchronization window, where the user has to manually decide, whether the change should be reflected into his database (update an item in Sitecore) or whether it should change in the TDS project (prepare for commit into the versioned system for other developers).

Apart from synchronization, this tool solves many other things simplifying the merging of items, deploying to other environments or generating codes mapping Sitecore items.

Unicorn

Unicorn is an Open Source tool, which is installed as a NuGet package directly into the Sitecore solution and influences the behavior of Sitecore during work with items via the Sitecore user interface.

As opposed to TDS, it does not create projects in solution. The tree of items for serializations is maintained in configuration files. Synchronization takes place using synchronization pages in Sitecore and all conflicts are solved on a disk while working with the version control system. Unicorn also has a pipeline for monitoring changes and even its own YAML serialization format using the Rainbow library. Apart from other things, it supports transparent synchronization for automatic synchronization of Sitecore items.

Apart from the cost, its other advantages mainly include speed, transparency and modularity. Unicorn also solves some problems with serializations because it is not sensitive for the end of rows. Therefore, there is no incompliance of the length of serialized data. Since Unicorn does not have its own project with items, there is no need to merge the project file, which in the case of TDS is oftentimes the source of mistakes.

A Brief Description of the Implementation of Unicorn

You can also easily implement Unicorn into an already existing project. The procedure is the same as for a new project. The correct configuration is the most important. The configuration files have abundant comments.

  1. Unicorn configurationOpen Visual Studio with your Sitecore project.
  2. Install the Nuget package Unicorn.
  3. Configure which locations Unicorn is to monitor. Everything is described well in the readme.txt Unicorn package and in the comments of the config files in the Unicorn folder. Of course, do not change the original files but perform modifications to the configuration using patches. For example, it is suitable to use transparent synchronization for the majority of locations.
    Patch the TargetDataStore in unicorn.config in such a way so that the serialized folder is in the folder monitored by the version control system. This is how you ensure the sharing of items among developers.
  4. Go to the /unicorn.aspx page on your Sitecore instance and sign in as admin. Perform the initial serialization here. This is how serialization items will appear on the disk. It is sufficient to add these into the version control system.

Synchronization

Following the primary serialization, Unicorn monitors the changes of items and apart from manual synchronization via the unicorn.aspx page, you can select automatic synchronization, which in Unicorn, is known as transparent synchronization.

Unicorn.aspxIn a transparent synchronization, Unicorn automatically monitors all items from the configuration and it is not necessary to perform synchronization from the unicorn.aspx page. After downloading the serialized items from the versioned system, these changes automatically appear into Sitecore instance. The only things you need to solve are conflicts during the downloading of the version. Therefore, you need to decide whether to use your changed version or the one in the versioned system.

It is necessary to manually synchronize configurations with an unauthorized transparent synchronization. After downloading the new version with the changed items, all you need to do is go to the unicorn.aspx page and synchronize everything or just the module, which you are preparing to work with.

If you are creating new branches with Sitecore items, which have to be monitored using Unicorn and are not included in any of the existing configurations, then it is necessary to create a new configuration or add it into an existing one.

The best is to have more configurations and define dependencies among them. This enables you to easily reach a high level of modularity as well as synchronize only certain configurations and leave others unchanged. You can also have various synchronization configurations defined in various projects (modules).

Links

Team Development for Sitecore

Unicorn