Raven.Client.Indexes.AbstractTransformerCreationTask.ExecuteAsync C# (CSharp) Метод

ExecuteAsync() публичный Метод

Executes the index creation against the specified document store.
public ExecuteAsync ( IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention documentConvention ) : System.Threading.Tasks.Task
asyncDatabaseCommands IAsyncDatabaseCommands
documentConvention Raven.Client.Document.DocumentConvention
Результат System.Threading.Tasks.Task
		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.PutTransformerAsync(TransformerName, transformerDefinition)
				.ContinueWith(task => UpdateIndexInReplicationAsync(asyncDatabaseCommands, documentConvention, (client, url) =>
					client.DirectPutTransformerAsync(TransformerName, transformerDefinition, url)))
				.Unwrap();
		}
	}

Usage Example

Пример #1
0
		public override Task ExecuteTransformerAsync(AbstractTransformerCreationTask transformerCreationTask)
        {
            var list = ShardStrategy.Shards.Values.Select(x => x.AsyncDatabaseCommands).ToList();
            return ShardStrategy.ShardAccessStrategy.ApplyAsync(list,
                                                            new ShardRequestData()
                                                            , (commands, i) =>
                                                            {
                                                                var tcs = new TaskCompletionSource<bool>();

                                                                try
                                                                {
                                                                    transformerCreationTask.ExecuteAsync(commands, Conventions)
                                                                        .ContinueWith(t => tcs.SetResult(true));
                                                                }
                                                                catch (Exception e)
                                                                {
                                                                    tcs.SetException(e);
                                                                }

                                                                return tcs.Task;
                                                            });
        }
All Usage Examples Of Raven.Client.Indexes.AbstractTransformerCreationTask::ExecuteAsync