/// <summary> /// Executes the index creation against the specified document store. /// </summary> public virtual async Task ExecuteAsync(IDocumentStore documentStore, DocumentConvention documentConvention, CancellationToken token = default(CancellationToken)) { Conventions = documentConvention; var prettify = documentConvention.PrettifyGeneratedLinqExpressions; var transformerDefinition = CreateTransformerDefinition(prettify); var requestExecuter = documentStore.GetRequestExecuter(documentStore.DefaultDatabase); JsonOperationContext jsonOperationContext; requestExecuter.ContextPool.AllocateOperationContext(out jsonOperationContext); var putTransformerOperation = new PutTransformerOperation(jsonOperationContext); var putTransformerCommand = putTransformerOperation.CreateRequest(documentConvention, TransformerName, transformerDefinition); if (putTransformerCommand != null) { await requestExecuter.ExecuteAsync(putTransformerCommand, jsonOperationContext, token); putTransformerOperation.SetResult(putTransformerCommand.Result); } //await ReplicateTransformerIfNeededAsync(asyncDatabaseCommands).ConfigureAwait(false); }
/// <summary> /// Executes the index creation against the specified document database using the specified conventions /// </summary> public virtual void Execute(IDocumentStore documentStore, DocumentConvention documentConvention) { Conventions = documentConvention; var prettify = documentConvention.PrettifyGeneratedLinqExpressions; var transformerDefinition = CreateTransformerDefinition(prettify); var requestExecuter = documentStore.GetRequestExecuter(documentStore.DefaultDatabase); JsonOperationContext jsonOperationContext; requestExecuter.ContextPool.AllocateOperationContext(out jsonOperationContext); var putTransformerOperation = new PutTransformerOperation(jsonOperationContext); var putTransformerCommand = putTransformerOperation.CreateRequest(documentConvention, TransformerName, transformerDefinition); if (putTransformerCommand != null) { requestExecuter.Execute(putTransformerCommand, jsonOperationContext); putTransformerOperation.SetResult(putTransformerCommand.Result); } /*if (documentConvention.IndexAndTransformerReplicationMode.HasFlag(IndexAndTransformerReplicationMode.Transformers)) * ReplicateTransformerIfNeeded(databaseCommands);*/ }