Net.Sf.Dbdeploy.Scripts.ChangeScriptRepository.CheckForDuplicateIds C# (CSharp) Method

CheckForDuplicateIds() private static method

Checks for duplicate ids in the list of change scripts.
There is more than one change script with number + lastId
private static CheckForDuplicateIds ( IEnumerable scripts ) : void
scripts IEnumerable The scripts.
return void
        private static void CheckForDuplicateIds(IEnumerable<ChangeScript> scripts)
        {
            string lastKey = null;

            // Since scripts are ordered, if one following is the same, we know there is a duplicate.
            foreach (var script in scripts)
            {
                if (string.Equals(script.UniqueKey, lastKey, StringComparison.InvariantCultureIgnoreCase))
                {
                    throw new DuplicateChangeScriptException(string.Format("There is more than one change script with key '{0}'.", lastKey));
                }

                lastKey = script.UniqueKey;
            }
        }
    }