public void ValidateAddIndexAssignUpdateStrategies(string createIndexStatementName, IndexMultiKey imk, string indexName) { // add index - for now _eventTableIndexMetadataRepo.AddIndex(false, imk, indexName, createIndexStatementName, true); // validate strategies, rollback if required foreach (var stmtEntry in _stmtNameToUpdateStrategyReceivers) { foreach (var strategyReceiver in stmtEntry.Value) { try { TableUpdateStrategyFactory.ValidateGetTableUpdateStrategy(this, strategyReceiver.UpdateHelper, strategyReceiver.IsOnMerge); } catch (ExprValidationException ex) { _eventTableIndexMetadataRepo.RemoveIndex(imk); throw new ExprValidationException("Failed to validate statement '" + stmtEntry.Key + "' as a recipient of the proposed index: " + ex.Message); } } } // assign new strategies foreach (var stmtEntry in _stmtNameToUpdateStrategyReceivers) { foreach (var strategyReceiver in stmtEntry.Value) { var strategy = TableUpdateStrategyFactory.ValidateGetTableUpdateStrategy(this, strategyReceiver.UpdateHelper, strategyReceiver.IsOnMerge); strategyReceiver.Receiver.Update(strategy); } } }
public void RemoveIndexReferencesStmtMayRemoveIndex(IndexMultiKey imk, string finalStatementName) { bool last = _eventTableIndexMetadataRepo.RemoveIndexReference(imk, finalStatementName); if (last) { _eventTableIndexMetadataRepo.RemoveIndex(imk); RemoveAllInstanceIndexes(imk); } }