/// <summary> /// Executes indexes creation in side-by-side mode. /// </summary> public virtual void SideBySideExecuteIndexes(List <AbstractIndexCreationTask> indexCreationTasks, Etag minimumEtagBeforeReplace = null, DateTime?replaceTimeUtc = null) { var indexesToAdd = IndexCreation.CreateIndexesToAdd(indexCreationTasks, Conventions); DatabaseCommands.PutSideBySideIndexes(indexesToAdd, minimumEtagBeforeReplace, replaceTimeUtc); foreach (var task in indexCreationTasks) { task.AfterExecute(DatabaseCommands, Conventions); } }
/// <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>(); try { var tasks = catalogToGetnIndexingTasksFrom .GetExportedValues <AbstractIndexCreationTask>() .ToList(); var indexesToAdd = CreateIndexesToAdd(tasks, conventions); databaseCommands.PutSideBySideIndexes(indexesToAdd, minimumEtagBeforeReplace, replaceTimeUtc); foreach (var task in tasks) { task.AfterExecute(databaseCommands, conventions); } } // For old servers that don't have the new endpoint for executing multiple indexes catch (Exception) { foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues <AbstractIndexCreationTask>()) { try { task.SideBySideExecute(databaseCommands, conventions, minimumEtagBeforeReplace, replaceTimeUtc); } catch (IndexCompilationException e) { indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile side by side index name = " + task.IndexName, e)); } } } CreateTransformers(catalogToGetnIndexingTasksFrom, databaseCommands, conventions); if (indexCompilationExceptions.Any()) { throw new AggregateException("Failed to create one or more side by side indexes. Please see inner exceptions for more details.", indexCompilationExceptions); } }
/// <summary> /// Creates the indexes found in the specified assembly in side-by-side mode. /// </summary> public static void SideBySideCreateIndexes(Assembly assemblyToScan, IDatabaseCommands databaseCommands, DocumentConvention conventions, long?minimumEtagBeforeReplace = null, DateTime?replaceTimeUtc = null) { var indexCompilationExceptions = new List <IndexCompilationException>(); try { var tasks = GetAllInstancesOfType <AbstractIndexCreationTask>(assemblyToScan) .ToList(); var indexesToAdd = CreateIndexesToAdd(tasks, conventions); databaseCommands.PutSideBySideIndexes(indexesToAdd, minimumEtagBeforeReplace, replaceTimeUtc); foreach (var task in tasks) { task.AfterExecute(databaseCommands, conventions); } } // For old servers that don't have the new endpoint for executing multiple indexes catch (Exception) { foreach (var task in GetAllInstancesOfType <AbstractIndexCreationTask>(assemblyToScan)) { try { task.SideBySideExecute(databaseCommands, conventions, minimumEtagBeforeReplace, replaceTimeUtc); } catch (IndexCompilationException e) { indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile side by side index name = " + task.IndexName, e)); } } } CreateTransformers(assemblyToScan, databaseCommands, conventions); if (indexCompilationExceptions.Any()) { throw new AggregateException("Failed to create one or more side by side indexes. Please see inner exceptions for more details.", indexCompilationExceptions); } }
/// <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>(); try { var tasks = catalogToGetnIndexingTasksFrom .GetExportedValues<AbstractIndexCreationTask>() .ToList(); var indexesToAdd = CreateIndexesToAdd(tasks, conventions); databaseCommands.PutSideBySideIndexes(indexesToAdd, minimumEtagBeforeReplace, replaceTimeUtc); foreach (var task in tasks) task.AfterExecute(databaseCommands, conventions); } // For old servers that don't have the new endpoint for executing multiple indexes catch (Exception) { foreach (var task in catalogToGetnIndexingTasksFrom.GetExportedValues<AbstractIndexCreationTask>()) { try { task.SideBySideExecute(databaseCommands, conventions, minimumEtagBeforeReplace, replaceTimeUtc); } catch (IndexCompilationException e) { indexCompilationExceptions.Add(new IndexCompilationException("Failed to compile side by side index name = " + task.IndexName, e)); } } } CreateTransformers(catalogToGetnIndexingTasksFrom, databaseCommands, conventions); if (indexCompilationExceptions.Any()) throw new AggregateException("Failed to create one or more side by side indexes. Please see inner exceptions for more details.", indexCompilationExceptions); }