예제 #1
0
        /// <summary>
        /// Executes the index creation against the specified document store.
        /// </summary>
        public virtual async Task ExecuteAsync(IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention documentConvention, CancellationToken token = default(CancellationToken))
        {
            Conventions = documentConvention;
            var transformerDefinition = CreateTransformerDefinition(documentConvention.PrettifyGeneratedLinqExpressions);
            // 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.
            await asyncDatabaseCommands.PutTransformerAsync(TransformerName, transformerDefinition, token);

            await ReplicateTransformerIfNeededAsync(asyncDatabaseCommands);
        }
예제 #2
0
        protected override Task PutTransformer(string transformerName, RavenJToken transformer)
        {
            if (transformer != null)
            {
                var transformerDefinition = JsonConvert.DeserializeObject <TransformerDefinition>(transformer.Value <RavenJObject>("definition").ToString());

                return(commands.PutTransformerAsync(transformerName, transformerDefinition));
            }

            return(FlushBatch());
        }
        /// <summary>
        /// Executes the index creation against the specified document store.
        /// </summary>
        public virtual Task ExecuteAsync(IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention documentConvention)
        {
            Conventions = documentConvention;
            var transformerDefinition = CreateTransformerDefinition(documentConvention.PrettifyGeneratedLinqExpressions);

            // 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());
        }
예제 #4
0
        protected async override Task PutTransformer(string transformerName, RavenJToken transformer)
        {
            if (IsTransformersSupported == false)
            {
                return;
            }

            if (transformer != null)
            {
                var transformerDefinition = JsonConvert.DeserializeObject <TransformerDefinition>(transformer.Value <RavenJObject>("definition").ToString());
                await Commands.PutTransformerAsync(transformerName, transformerDefinition);
            }

            await FlushBatch();
        }
예제 #5
0
        protected override Task PutTransformer(string transformerName, RavenJToken transformer)
        {
            if (Mode == SmugglerMode.Legacy)
            {
                return(new CompletedTask());
            }

            if (transformer != null)
            {
                var transformerDefinition = JsonConvert.DeserializeObject <TransformerDefinition>(transformer.Value <RavenJObject>("definition").ToString());

                return(Commands.PutTransformerAsync(transformerName, transformerDefinition));
            }

            return(FlushBatch());
        }
		/// <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.PutTransformerAsync(TransformerName, transformerDefinition)
				.ContinueWith(task => UpdateIndexInReplicationAsync(asyncDatabaseCommands, documentConvention, (client, url) =>
					client.DirectPutTransformerAsync(TransformerName, transformerDefinition, url)))
				.Unwrap();
		}