/// <summary> /// Executes the index creation against the specified document store. /// </summary> public virtual Task ExecuteAsync(IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention documentConvention) { Conventions = documentConvention; var transformerDefinition = CreateTransformerDefinition(); // This code take advantage on the fact that RavenDB will turn an index PUT // to a noop of the index already exists and the stored definition matches // the new definition. return asyncDatabaseCommands.PutTransfomerAsync(TransfomerName, transformerDefinition) .ContinueWith(task => UpdateIndexInReplicationAsync(asyncDatabaseCommands, documentConvention, (client, url) => client.DirectPutTransformerAsync(TransfomerName, transformerDefinition, url))) .Unwrap(); }