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


C# AbstractIndexCreationTask.Execute方法代码示例

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


在下文中一共展示了AbstractIndexCreationTask.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: ExecuteIndex

		/// <summary>
		/// Executes the index creation.
		/// </summary>
		public virtual void ExecuteIndex(AbstractIndexCreationTask indexCreationTask)
		{
			indexCreationTask.Execute(DatabaseCommands, Conventions);
		}
开发者ID:synhershko,项目名称:ravendb,代码行数:7,代码来源:DocumentStoreBase.cs

示例4: 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


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