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


C# ExportProvider.GetExportedValues方法代码示例

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


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

示例1: CreateIndexes

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		/// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
		/// <param name="documentStore">The document store.</param>
		public static void CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore)
		{
		    foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
			{
				task.Execute(documentStore);
			}

            foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
            {
                task.Execute(documentStore);
            }
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:17,代码来源:IndexCreation.cs

示例2: CreateIndexes

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		public static void CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands, DocumentConvention conventions)
		{
			var indexCompilationExceptions = new List<IndexCompilationException>();
			try
			{
				var tasks = catalogToGetnIndexingTasksFrom
					.GetExportedValues<AbstractIndexCreationTask>()
					.ToList();

				var indexesToAdd = tasks
					.Select(x => new IndexToAdd
					{
						Definition = x.CreateIndexDefinition(),
						Name = x.IndexName,
						Priority = x.Priority ?? IndexingPriority.Normal
					})
					.ToArray();

				databaseCommands.PutIndexes(indexesToAdd);

				foreach (var task in tasks)
					task.AfterExecute(databaseCommands, conventions);
			}
			// For old servers that don't have the new entrypoint for executing multiple indexes
			catch (Exception)
			{
				foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
				{
					try
					{
						task.Execute(databaseCommands, conventions);
					}
					catch (IndexCompilationException e)
					{
						indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
					}

				}
			}
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
			{
				task.Execute(databaseCommands, conventions);
			}

			if (indexCompilationExceptions.Any())
				throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
		}
开发者ID:nwendel,项目名称:ravendb,代码行数:50,代码来源:IndexCreation.cs

示例3: CreateIndexesAsync

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		/// <param name="catalogToGetnIndexingTasksFrom">The catalog to getn indexing tasks from.</param>
		/// <param name="documentStore">The document store.</param>
		public static Task CreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore)
		{
			var tasks = catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>();

			Task[] array = tasks.Select(task => task.ExecuteAsync(documentStore)).ToArray();
			var indexesAsync = new Task(() => Task.WaitAll(array));
			indexesAsync.Start();
			return indexesAsync;
		}
开发者ID:aduggleby,项目名称:ravendb,代码行数:14,代码来源:IndexCreation.cs

示例4: CreateIndexesAsync

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		public static Task CreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention conventions)
		{
			var tasks = catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>();

			Task[] array = tasks.Select(task => task.ExecuteAsync(asyncDatabaseCommands, conventions)).ToArray();
			var indexesAsync = new Task(() => Task.WaitAll(array));
			indexesAsync.Start();
			return indexesAsync;
		}
开发者ID:remcoros,项目名称:ravendb,代码行数:12,代码来源:IndexCreation.cs

示例5: CreateIndexes

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		/// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
		/// <param name="documentStore">The document store.</param>
		public static void CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore)
		{
			var indexCompilationExceptions = new List<IndexCompilationException>();
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
			{
				try
				{
					task.Execute(documentStore);
				}
				catch (IndexCompilationException e)
				{
					indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
				}
			}

			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
			{
				task.Execute(documentStore);
			}

			if (indexCompilationExceptions.Any())
				throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
		}
开发者ID:cocytus,项目名称:ravendb,代码行数:28,代码来源:IndexCreation.cs

示例6: CreateIndexesAsync

        /// <summary>
        /// Creates the indexes found in the specified catalog
        /// </summary>
        public static async Task CreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IAsyncDatabaseCommands databaseCommands, DocumentConvention conventions)
        {
            var indexCompilationExceptions = new List<IndexCompilationException>();
            foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
            {
                try
                {
                    await task.ExecuteAsync(databaseCommands, conventions);
                }
                catch (IndexCompilationException e)
                {
                    indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
                }

            }

            foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
            {
                await task.ExecuteAsync(databaseCommands, conventions);
            }

            if (indexCompilationExceptions.Any())
                throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
        }
开发者ID:felipeleusin,项目名称:ravendb,代码行数:27,代码来源:IndexCreation.cs

示例7: GetCommandSettings

    	/// <summary>
    	/// This is all the command settings that are related to the file match element.
    	/// </summary>
    	/// <param name="container">The container for all the plugins.</param>
    	/// <param name="project">The project to get all the command settings for.</param>
    	/// <returns>Dictionary of command type/command </returns>
    	private Dictionary<string, List<string>> GetCommandSettings(ExportProvider container, ProjectElement project)
		{
			var currentConfigurationElementCollections = container.GetExportedValues<CurrentConfigurationElementCollection>()
				.Where(x => !_excludedElements.Contains(x.Setting.ElementSettingName));

			var commandSettings = new Dictionary<string, List<string>>();

			foreach (var configurationElementCollection in currentConfigurationElementCollections)
			{
				var collectionSettingName = configurationElementCollection.Setting.ElementCollectionSettingName;
				var configurationProperty = project.GetConfigurationProperty(collectionSettingName);
				var commandElementCollection = project.GetElementCollection<CurrentConfigurationElementCollection>(configurationProperty);
				var conversionType = commandElementCollection.Setting.ConversionType;
				var commandSettingKeys = new List<string>();
				for (var i = 0; i < commandElementCollection.Count; i++)
				{
					var commandElement = commandElementCollection[i];
					commandSettingKeys.Add(commandElement.Name);
				}
				commandSettings.Add(conversionType, commandSettingKeys);
			}

			return commandSettings;
		}
开发者ID:taliesins,项目名称:talifun-commander,代码行数:30,代码来源:FileMatchElementPanel.xaml.cs

示例8: CreateIndexesAsync

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		public static async Task CreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IAsyncDatabaseCommands asyncDatabaseCommands, DocumentConvention conventions)
		{
		    foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
		    {
		        await task.ExecuteAsync(asyncDatabaseCommands, conventions);
		    }
            foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
            {
                await task.ExecuteAsync(asyncDatabaseCommands, conventions);
            }
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:14,代码来源:IndexCreation.cs

示例9: SideBySideCreateIndexesAsync

		/// <summary>
		/// Creates the indexes found in the specified catalog in side-by-side mode.
		/// </summary>
		/// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
		/// <param name="documentStore">The document store.</param>
		public static async Task SideBySideCreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
		{
			var indexCompilationExceptions = new List<IndexCompilationException>();
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
			{
				try
				{
					await task.SideBySideExecuteAsync(documentStore, minimumEtagBeforeReplace, replaceTimeUtc).ConfigureAwait(false);
				}
				catch (IndexCompilationException e)
				{
					indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
				}
			}
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
			{
				await task.ExecuteAsync(documentStore).ConfigureAwait(false);
			}

			if (indexCompilationExceptions.Any())
				throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
		}
开发者ID:VPashkov,项目名称:ravendb,代码行数:27,代码来源:IndexCreation.cs

示例10: CreateTransformersAsync

 private static async Task CreateTransformersAsync(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore)
 {
     foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
     {
         await task.ExecuteAsync(documentStore).ConfigureAwait(false);
     }
 }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:7,代码来源:IndexCreation.cs

示例11: SideBySideCreateIndexesAsync

        /// <summary>
        /// Creates the indexes found in the specified catalog in side-by-side mode.
        /// </summary>
        /// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
        /// <param name="documentStore">The document store.</param>
        /// <param name="minimumEtagBeforeReplace">Minimum last indexed etag after which index will be replaced (map indexes only)</param>
        /// <param name="replaceTimeUtc"></param>
        public static async Task SideBySideCreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
        {
            var indexCompilationExceptions = new List<IndexCompilationException>();
            var failed = false;
            try
            {
                var tasks = catalogToGetnIndexingTasksFrom
                    .GetExportedValues<AbstractIndexCreationTask>()
                    .ToList();

                var indexesToAdd = CreateIndexesToAdd(tasks, documentStore.Conventions);
                await documentStore.AsyncDatabaseCommands.PutSideBySideIndexesAsync(indexesToAdd, minimumEtagBeforeReplace, replaceTimeUtc).ConfigureAwait(false);

                foreach (var task in tasks)
                    await task.AfterExecuteAsync(documentStore.AsyncDatabaseCommands, documentStore.Conventions).ConfigureAwait(false);
            }
            // For old servers that don't have the new endpoint for executing multiple indexes
            catch (Exception)
            {
                failed = true;
            }
            if (failed)
            {
                foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
                {
                    try
                    {
                        await task.SideBySideExecuteAsync(documentStore, minimumEtagBeforeReplace, replaceTimeUtc).ConfigureAwait(false);
                    }
                    catch (IndexCompilationException e)
                    {
                        indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile side by side index name = " + task.IndexName, e));
                    }
                }
            }

            await CreateTransformersAsync(catalogToGetnIndexingTasksFrom, documentStore).ConfigureAwait(false);

            if (indexCompilationExceptions.Any())
                throw new AggregateException("Failed to create one or more side by side indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
        }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:48,代码来源:IndexCreation.cs

示例12: SideBySideCreateIndexes

        /// <summary>
        /// Creates the indexes found in the specified catalog in side-by-side mode.
        /// </summary>
        /// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
        /// <param name="documentStore">The document store.</param>
        /// <param name="minimumEtagBeforeReplace">Minimum last indexed etag after which index will be replaced (map indexes only)</param>
        /// <param name="replaceTimeUtc"></param>
        public static void SideBySideCreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
        {
            var indexCompilationExceptions = new List<IndexCompilationException>();
            try
            {
                var tasks = catalogToGetnIndexingTasksFrom
                    .GetExportedValues<AbstractIndexCreationTask>()
                    .ToList();

                documentStore.SideBySideExecuteIndexes(tasks, minimumEtagBeforeReplace, replaceTimeUtc);
            }
            // For old servers that don't have the new endpoint for executing multiple indexes
            catch (Exception ex)
            {
                Log.InfoException("Could not create side by side indexes in one shot (maybe using older version of RavenDB ?)", ex);
                foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
                {
                    try
                    {
                        task.SideBySideExecute(documentStore, minimumEtagBeforeReplace, replaceTimeUtc);
                    }
                    catch (IndexCompilationException e)
                    {
                        indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile side by side index name = " + task.IndexName, e));
                    }
                }
            }

            CreateTransformers(catalogToGetnIndexingTasksFrom, documentStore);

            if (indexCompilationExceptions.Any())
                throw new AggregateException("Failed to create one or more side by indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
        }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:40,代码来源:IndexCreation.cs

示例13: CreateIndexes

		/// <summary>
		/// Creates the indexes found in the specified catalog
		/// </summary>
		/// <param name="catalogToGetnIndexingTasksFrom">The catalog to get indexing tasks from.</param>
		/// <param name="documentStore">The document store.</param>
		public static void CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore)
		{
			var indexCompilationExceptions = new List<IndexCompilationException>();
			try
			{
				var tasks = catalogToGetnIndexingTasksFrom
					.GetExportedValues<AbstractIndexCreationTask>()
					.ToList();

				documentStore.ExecuteIndexes(tasks);
			}
				// For old servers that don't have the new entrypoint for executing multiple indexes
			catch (Exception ex)
			{
			    Log.InfoException("Could not create indexes in one shot (maybe using older version of RavenDB ?)", ex);
				foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
				{
					try
					{
						task.Execute(documentStore);
					}
					catch (IndexCompilationException e)
					{
						indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
					}
				}
			}
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
			{
				task.Execute(documentStore);
			}

			if (indexCompilationExceptions.Any())
				throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
		}
开发者ID:VPashkov,项目名称:ravendb,代码行数:40,代码来源:IndexCreation.cs

示例14: SideBySideCreateIndexes

		/// <summary>
		/// Creates the indexes found in the specified catalog in side-by-side mode.
		/// </summary>
		public static void SideBySideCreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands, DocumentConvention conventions, Etag minimumEtagBeforeReplace = null, DateTime? replaceTimeUtc = null)
		{
			var indexCompilationExceptions = new List<IndexCompilationException>();
			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
			{
				try
				{
					task.SideBySideExecute(databaseCommands, conventions, minimumEtagBeforeReplace, replaceTimeUtc);
				}
				catch (IndexCompilationException e)
				{
					indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
				}

			}

			foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
			{
				task.Execute(databaseCommands, conventions);
			}

			if (indexCompilationExceptions.Any())
				throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
		}
开发者ID:VPashkov,项目名称:ravendb,代码行数:27,代码来源:IndexCreation.cs

示例15: CreateIndexesAsync

        /// <summary>
        /// Creates the indexes found in the specified catalog
        /// </summary>
        public static async Task CreateIndexesAsync(ExportProvider catalogToGetnIndexingTasksFrom, IAsyncDatabaseCommands databaseCommands, DocumentConvention conventions)
        {
            var indexCompilationExceptions = new List<IndexCompilationException>();
			bool failed = false;
	        try
	        {
		        var tasks = catalogToGetnIndexingTasksFrom
					.GetExportedValues<AbstractIndexCreationTask>()
					.ToList();

				var indexesNames = tasks.Select(x => x.IndexName).ToArray();
				var definitions = tasks.Select(x => x.CreateIndexDefinition()).ToArray();
				var priorities = tasks.Select(x => x.Priority ?? IndexingPriority.Normal).ToArray();
				await databaseCommands.PutIndexesAsync(indexesNames, definitions, priorities).ConfigureAwait(false);

		        foreach (var task in tasks)
					await task.AfterExecuteAsync(databaseCommands, conventions).ConfigureAwait(false);
	        }
			
		        // For old servers that don't have the new entrypoint for executing multiple indexes
	        catch (Exception)
	        {
		        failed = true;		        
	        }
	        if (failed)
	        {
				foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>())
				{
					try
					{
						await task.ExecuteAsync(databaseCommands, conventions).ConfigureAwait(false);
					}
					catch (IndexCompilationException e)
					{
						indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile index name = " + task.IndexName, e));
					}

				}
	        }
	        foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractTransformerCreationTask>())
            {
				await task.ExecuteAsync(databaseCommands, conventions).ConfigureAwait(false);
            }

            if (indexCompilationExceptions.Any())
                throw new AggregateException("Failed to create one or more indexes. Please see inner exceptions for more details.", indexCompilationExceptions);
        }
开发者ID:VPashkov,项目名称:ravendb,代码行数:50,代码来源:IndexCreation.cs


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