diff options
Diffstat (limited to 'src/WixToolset.Data/WindowsInstaller/Table.cs')
| -rw-r--r-- | src/WixToolset.Data/WindowsInstaller/Table.cs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/WixToolset.Data/WindowsInstaller/Table.cs b/src/WixToolset.Data/WindowsInstaller/Table.cs index ca6fe3ba..714be20f 100644 --- a/src/WixToolset.Data/WindowsInstaller/Table.cs +++ b/src/WixToolset.Data/WindowsInstaller/Table.cs | |||
| @@ -60,6 +60,27 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /// <summary> | 62 | /// <summary> |
| 63 | /// Validates the rows of this OutputTable and throws if it collides on | ||
| 64 | /// primary keys. | ||
| 65 | /// </summary> | ||
| 66 | public void ValidateRows() | ||
| 67 | { | ||
| 68 | var primaryKeys = new Dictionary<string, SourceLineNumber>(); | ||
| 69 | |||
| 70 | foreach (var row in this.Rows) | ||
| 71 | { | ||
| 72 | var primaryKey = row.GetPrimaryKey(); | ||
| 73 | |||
| 74 | if (primaryKeys.TryGetValue(primaryKey, out var collisionSourceLineNumber)) | ||
| 75 | { | ||
| 76 | throw new WixException(ErrorMessages.DuplicatePrimaryKey(collisionSourceLineNumber, primaryKey, this.Definition.Name)); | ||
| 77 | } | ||
| 78 | |||
| 79 | primaryKeys.Add(primaryKey, row.SourceLineNumbers); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | /// <summary> | ||
| 63 | /// Parse a table from the xml. | 84 | /// Parse a table from the xml. |
| 64 | /// </summary> | 85 | /// </summary> |
| 65 | /// <param name="reader">XmlReader where the intermediate is persisted.</param> | 86 | /// <param name="reader">XmlReader where the intermediate is persisted.</param> |
| @@ -165,26 +186,5 @@ namespace WixToolset.Data.WindowsInstaller | |||
| 165 | 186 | ||
| 166 | writer.WriteEndElement(); | 187 | writer.WriteEndElement(); |
| 167 | } | 188 | } |
| 168 | |||
| 169 | /// <summary> | ||
| 170 | /// Validates the rows of this OutputTable and throws if it collides on | ||
| 171 | /// primary keys. | ||
| 172 | /// </summary> | ||
| 173 | public void ValidateRows() | ||
| 174 | { | ||
| 175 | var primaryKeys = new Dictionary<string, SourceLineNumber>(); | ||
| 176 | |||
| 177 | foreach (var row in this.Rows) | ||
| 178 | { | ||
| 179 | var primaryKey = row.GetPrimaryKey(); | ||
| 180 | |||
| 181 | if (primaryKeys.TryGetValue(primaryKey, out var collisionSourceLineNumber)) | ||
| 182 | { | ||
| 183 | throw new WixException(ErrorMessages.DuplicatePrimaryKey(collisionSourceLineNumber, primaryKey, this.Definition.Name)); | ||
| 184 | } | ||
| 185 | |||
| 186 | primaryKeys.Add(primaryKey, row.SourceLineNumbers); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | } | 189 | } |
| 190 | } | 190 | } |
