Ensure unreal columns are not added to _Validation table
Rob Mensching committed
Jun 15, 2020 at 15:42 UTC
3c4ccd506d6c7d62e64c633d03a5bace2ebcbcd1
1 file changed
+34
-36
src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
+34
-36
@@ -6,6 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
using System.IO;
9
+ using System.Linq;
10
using System.Text;
11
using WixToolset.Core.WindowsInstaller.Msi;
12
using WixToolset.Data;
@@ -131,54 +132,51 @@ namespace WixToolset.Core.WindowsInstaller.Bind
132
{
133
var validationTable = this.Data.EnsureTable(this.TableDefinitions["_Validation"]);
134
134
- foreach (var table in this.Data.Tables)
135
+ // Add the validation rows for real tables and columns.
136
+ foreach (var table in this.Data.Tables.Where(t => !t.Definition.Unreal))
137
{
136
- if (!table.Definition.Unreal)
138
+ foreach (var columnDef in table.Definition.Columns.Where(c => !c.Unreal))
139
{
138
- // Add the validation rows for this table.
139
- foreach (var columnDef in table.Definition.Columns)
140
- {
141
- var row = validationTable.CreateRow(null);
140
+ var row = validationTable.CreateRow(null);
141
143
- row[0] = table.Name;
142
+ row[0] = table.Name;
143
145
- row[1] = columnDef.Name;
144
+ row[1] = columnDef.Name;
145
147
- if (columnDef.Nullable)
148
- {
149
- row[2] = "Y";
150
- }
151
- else
152
- {
153
- row[2] = "N";
154
- }
146
+ if (columnDef.Nullable)
147
+ {
148
+ row[2] = "Y";
149
+ }
150
+ else
151
+ {
152
+ row[2] = "N";
153
+ }
154
156
- if (columnDef.MinValue.HasValue)
157
- {
158
- row[3] = columnDef.MinValue.Value;
159
- }
155
+ if (columnDef.MinValue.HasValue)
156
+ {
157
+ row[3] = columnDef.MinValue.Value;
158
+ }
159
161
- if (columnDef.MaxValue.HasValue)
162
- {
163
- row[4] = columnDef.MaxValue.Value;
164
- }
160
+ if (columnDef.MaxValue.HasValue)
161
+ {
162
+ row[4] = columnDef.MaxValue.Value;
163
+ }
164
166
- row[5] = columnDef.KeyTable;
165
+ row[5] = columnDef.KeyTable;
166
168
- if (columnDef.KeyColumn.HasValue)
169
- {
170
- row[6] = columnDef.KeyColumn.Value;
171
- }
167
+ if (columnDef.KeyColumn.HasValue)
168
+ {
169
+ row[6] = columnDef.KeyColumn.Value;
170
+ }
171
173
- if (ColumnCategory.Unknown != columnDef.Category)
174
- {
175
- row[7] = columnDef.Category.ToString();
176
- }
172
+ if (ColumnCategory.Unknown != columnDef.Category)
173
+ {
174
+ row[7] = columnDef.Category.ToString();
175
+ }
176
178
- row[8] = columnDef.Possibilities;
177
+ row[8] = columnDef.Possibilities;
178
180
- row[9] = columnDef.Description;
181
- }
179
+ row[9] = columnDef.Description;
180
}
181
}
182
}