Unicorn

Other topics

Manual Installation/Install from Source

  • Clone the repository
  • Place a copy of your Sitecore.Kernel.dll assembly in /lib/sitecore/v7 (for v7/v8)
  • Build the project for your Sitecore version using Visual Studio 2012 or later
  • Copy Unicorn.dll, Rainbow.dll, Rainbow.Storage.Sc.dll, Rainbow.Storage.Yaml.dll and Kamsar.WebConsole.dll to your main project in whatever fashion you wish (project reference, as binary references, etc)
  • Copy Standard Config Files*.config to the App_Config\Include\Unicorn folder
  • Configure to your liking; the setup README file is a good starting point.
  • Hit $yoursite/unicorn.aspx to perform initial serialization of your configured predicate

Initial Setup

PM> Install-Package Unicorn

  • When you install the NuGet package, a README file will come up in Visual Studio with help to get you started.

Data Provider Architecture

There are two components to the Unicorn data provider: the database-specific implementation, and the Unicorn implementation.

The Unicorn implementation is an individual configuration of Unicorn dependencies that get automatic serialization. For example, if you were serializing two presets you'd need two instances of UnicornDataProvider - one for each IPredicate implementation.

The database specific implementation is a subclass of the original Sitecore data provider that provides a container for one or more UnicornDataProvider instances. Out of the box, a UnicornSqlServerDataProvider is provided. You could roll your own if you're on Oracle. This provider is effectively an unblockable event handler that allows Unicorn to trap item changes even if the evil EventDisabler class is being used.

If you want to wire multiple Unicorn data providers to your database, you create a class that derives from UnicornSqlServerDataProvider. In this class you can select to:

  • Create a constructor that injects your provider(s) using the base constructor:
public MyDataProvider(string connectionString) :
base(connectionString, new UnicornDataProvider(), new
UnicornDataProvider(), ...)
  • Create a constructor that injects your provider(s) using code (this is better if you have to construct dependencies, etc that don't fit well in a base call):
public MyDataProvider(string connectionString) : base(connectionString, null)
 {
    AddUnicornDataProvider(new UnicornDataProvider());
    // ...
 }

Contributors

Topic Id: 8852

Example Ids: 27581,27580,27582

This site is not affiliated with any of the contributors.