当前位置: 首页>>代码示例>>C#>>正文


C# Indexes.AbstractIndexCreationTask类代码示例

本文整理汇总了C#中Raven.Client.Indexes.AbstractIndexCreationTask的典型用法代码示例。如果您正苦于以下问题:C# AbstractIndexCreationTask类的具体用法?C# AbstractIndexCreationTask怎么用?C# AbstractIndexCreationTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractIndexCreationTask类属于Raven.Client.Indexes命名空间,在下文中一共展示了AbstractIndexCreationTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildIndexAsync

        /// <summary>
        /// Build a single index asynchronously
        /// </summary>
        /// <param name="indexInstance">An activated AbstractIndexCreationTask instance</param>
        /// <param name="progressCallBack">A callback we can use to report on the progress of a batch job; default is null</param>
        /// <returns>A task containing an IndexBuildResult report for this specific index</returns>
        public Task<IndexBuildResult> BuildIndexAsync(AbstractIndexCreationTask indexInstance, Action<IndexBuildResult> progressCallBack = null)
        {
            return Task.Factory.StartNew(() => indexInstance.Execute(_documentStore))
                .ContinueWith(result =>
                                  {
                                      var indexBuildResult = new IndexBuildResult()
                                                                 {IndexName = indexInstance.IndexName, ConnectionString = _documentStore.Identifier};

                                      if (result.IsCompleted && result.Exception == null)
                                      {
                                          indexBuildResult.Result = BuildResult.Created;
                                      }
                                      else if (result.IsCanceled)
                                      {
                                          indexBuildResult.Result = BuildResult.Cancelled;
                                      }
                                      else
                                      {
                                          indexBuildResult.Result = BuildResult.Failed;
                                          indexBuildResult.BuildException = result.Exception != null ? result.Exception.Flatten() : null;
                                      }

                                      if (progressCallBack != null)
                                      {
                                          progressCallBack.Invoke(indexBuildResult);
                                      }

                                      return indexBuildResult;
                                  });
        }
开发者ID:rickj33,项目名称:hircine,代码行数:36,代码来源:IndexBuilder.cs

示例2: BuildIndex

        /// <summary>
        /// Build a single index synchronously
        /// </summary>
        /// <param name="indexInstance">An activated AbstractIndexCreationTask instance</param>
        /// <returns>An IndexBuildResult report for this specific index</returns>
        public IndexBuildResult BuildIndex(AbstractIndexCreationTask indexInstance)
        {
            var buildIndexTask = BuildIndexAsync(indexInstance, null);

            buildIndexTask.Wait();

            return buildIndexTask.Result;
        }
开发者ID:rickj33,项目名称:hircine,代码行数:13,代码来源:IndexBuilder.cs

示例3: PutIndex

        public void PutIndex(AbstractIndexCreationTask index)
        {
            var response = httpClient
                .PutAsync(databaseUrl + "/indexes/" + Uri.EscapeUriString(index.IndexName), new JsonContent(RavenJObject.FromObject(index.CreateIndexDefinition())))
                .ResultUnwrap();

            if (response.IsSuccessStatusCode == false)
                throw new InvalidOperationException(string.Format("PUT failed on '{0}'. Code: {1}.", index.IndexName, response.StatusCode));
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:9,代码来源:ThinClient.cs

示例4: SafelyCreateIndex

 /// <summary>
 /// Safely add the index to the RavenDB database, protect against possible failures caused by documented
 /// and undocumented possibilities of failure.
 /// Will throw iff index registration failed and index doesn't exist or it exists but with a non-current definition.
 /// </summary>
 /// <param name="store"></param>
 /// <param name="index"></param>
 internal static void SafelyCreateIndex(IDocumentStore store, AbstractIndexCreationTask index)
 {
     try
     {
         index.Execute(store);
     }
     catch (Exception) // Apparently ArgumentException can be thrown as well as a WebException; not taking any chances
     {
         var existingIndex = store.DatabaseCommands.GetIndex(index.IndexName);
         if (existingIndex == null || !index.CreateIndexDefinition().Equals(existingIndex))
             throw;
     }
 }
开发者ID:hanin,项目名称:NServiceBus.RavenDB,代码行数:20,代码来源:Helpers.cs

示例5: SideBySideExecuteIndex

	    public void SideBySideExecuteIndex(AbstractIndexCreationTask indexCreationTask, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
	    {
			Inner.SideBySideExecuteIndex(indexCreationTask, minimumEtagBeforeReplace, replaceTimeUtc);
	    }
开发者ID:GorelH,项目名称:ravendb,代码行数:4,代码来源:EmbeddableDocumentStore.cs

示例6: ExecuteIndexAsync

	    /// <summary>
        ///     Executes the index creation.
        /// </summary>
        /// <param name="indexCreationTask"></param>
        public Task ExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask)
        {
            return server.DocumentStore.ExecuteIndexAsync(indexCreationTask);
        }
开发者ID:VPashkov,项目名称:ravendb,代码行数:8,代码来源:EmbeddedDocumentStore.cs

示例7: ExecuteIndex

 /// <summary>
 ///     Executes the index creation.
 /// </summary>
 public void ExecuteIndex(AbstractIndexCreationTask indexCreationTask)
 {
     server.DocumentStore.ExecuteIndex(indexCreationTask);
 }
开发者ID:VPashkov,项目名称:ravendb,代码行数:7,代码来源:EmbeddedDocumentStore.cs

示例8: SideBySideExecuteIndexAsync

		public override Task SideBySideExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
		{
			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
				{
					indexCreationTask.SideBySideExecuteAsync(commands, Conventions, minimumEtagBeforeReplace, replaceTimeUtc)
									 .ContinueWith(t => tcs.SetResult(true));
				}
				catch (Exception e)
				{
					tcs.SetException(e);
				}

				return tcs.Task;
			});
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:20,代码来源:ShardedDocumentStore.cs

示例9: ExecuteIndex

 public void ExecuteIndex(AbstractIndexCreationTask indexCreationTask)
 {
     this.ThrowIfNotInitialized();
     this.innerStore.ExecuteIndex(indexCreationTask);
 }
开发者ID:paulkearney,项目名称:brnkly,代码行数:5,代码来源:BrnklyDocumentStore.cs

示例10: ExecuteIndexAsync

 public Task ExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask)
 {
     return Inner.ExecuteIndexAsync(indexCreationTask);
 }
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:4,代码来源:EmbeddableDocumentStore.cs

示例11: ExecuteIndex

		/// <summary>
		/// Executes the index creation against each of the shards.
		/// </summary>
		public override void ExecuteIndex(AbstractIndexCreationTask indexCreationTask)
		{
			var list = ShardStrategy.Shards.Values.Select(x => x.DatabaseCommands).ToList();
			ShardStrategy.ShardAccessStrategy.Apply(list,
															new ShardRequestData()
															, (commands, i) =>
															{
																indexCreationTask.Execute(commands, Conventions);
																return (object)null;
															});
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:14,代码来源:ShardedDocumentStore.cs

示例12: ExecuteIndexAsync

	    public virtual Task ExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask)
	    {
	        return indexCreationTask.ExecuteAsync(AsyncDatabaseCommands, Conventions);
	    }
开发者ID:felipeleusin,项目名称:ravendb,代码行数:4,代码来源:DocumentStoreBase.cs

示例13: SideBySideExecuteIndexAsync

		/// <summary>
		/// Executes the index creation in side-by-side mode.
		/// </summary>
		public virtual Task SideBySideExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
		{
			return indexCreationTask.SideBySideExecuteAsync(AsyncDatabaseCommands, Conventions, minimumEtagBeforeReplace, replaceTimeUtc);
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:7,代码来源:DocumentStoreBase.cs

示例14: SideBySideExecuteIndex

		/// <summary>
		/// Executes the index creation in side-by-side mode.
		/// </summary>
		public virtual void SideBySideExecuteIndex(AbstractIndexCreationTask indexCreationTask, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
		{
			indexCreationTask.SideBySideExecute(DatabaseCommands, Conventions, minimumEtagBeforeReplace, replaceTimeUtc);
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:7,代码来源:DocumentStoreBase.cs

示例15: SideBySideExecuteIndexAsync

	    public Task SideBySideExecuteIndexAsync(AbstractIndexCreationTask indexCreationTask, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
	    {
		    return Inner.SideBySideExecuteIndexAsync(indexCreationTask, minimumEtagBeforeReplace, replaceTimeUtc);
	    }
开发者ID:GorelH,项目名称:ravendb,代码行数:4,代码来源:EmbeddableDocumentStore.cs


注:本文中的Raven.Client.Indexes.AbstractIndexCreationTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。