aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-11 21:49:09 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-12 12:46:21 +1000
commit6d8b6f79b44b6a41a630aa3aad5a3c7f16701798 (patch)
treeb82ede9934cb7777a19e74a912c68481e76c21cd /src
parentdf69d4172d3117d8b66ba51fa5ae7f4be538700d (diff)
downloadwix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.gz
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.bz2
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.zip
General cleanup.
Try not to send strings to specify the tuple or table. Try to avoid using the Set method on tuples. Always create new tuples and add them to the section in the same line.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs12
-rw-r--r--src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs11
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs6
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs6
-rw-r--r--src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs34
-rw-r--r--src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs6
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs6
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs31
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs38
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs24
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs2
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs20
-rw-r--r--src/WixToolset.Core/Binder.cs10
-rw-r--r--src/WixToolset.Core/Compiler.cs415
-rw-r--r--src/WixToolset.Core/CompilerCore.cs62
-rw-r--r--src/WixToolset.Core/Compiler_2.cs288
-rw-r--r--src/WixToolset.Core/Compiler_Bundle.cs97
-rw-r--r--src/WixToolset.Core/Compiler_EmbeddedUI.cs16
-rw-r--r--src/WixToolset.Core/Compiler_Module.cs38
-rw-r--r--src/WixToolset.Core/Compiler_Patch.cs16
-rw-r--r--src/WixToolset.Core/Compiler_PatchCreation.cs38
-rw-r--r--src/WixToolset.Core/Compiler_UI.cs153
-rw-r--r--src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs115
-rw-r--r--src/WixToolset.Core/Link/WixGroupingOrdering.cs16
-rw-r--r--src/WixToolset.Core/Linker.cs79
-rw-r--r--src/test/Example.Extension/ExampleCompilerExtension.cs10
27 files changed, 660 insertions, 891 deletions
diff --git a/src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs b/src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs
index 7f36dbcc..e228b296 100644
--- a/src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs
+++ b/src/WixToolset.Core.Burn/Bind/ProcessDependencyProvidersCommand.cs
@@ -56,14 +56,14 @@ namespace WixToolset.Core.Burn.Bind
56 56
57 if (this.Facades.TryGetValue(packageId, out var facade)) 57 if (this.Facades.TryGetValue(packageId, out var facade))
58 { 58 {
59 var dependency = new ProvidesDependencyTuple(wixDependencyProviderTuple.SourceLineNumbers, wixDependencyProviderTuple.Id) 59 var dependency = this.Section.AddTuple(new ProvidesDependencyTuple(wixDependencyProviderTuple.SourceLineNumbers, wixDependencyProviderTuple.Id)
60 { 60 {
61 PackageRef = packageId, 61 PackageRef = packageId,
62 Key = wixDependencyProviderTuple.ProviderKey, 62 Key = wixDependencyProviderTuple.ProviderKey,
63 Version = wixDependencyProviderTuple.Version, 63 Version = wixDependencyProviderTuple.Version,
64 DisplayName = wixDependencyProviderTuple.DisplayName, 64 DisplayName = wixDependencyProviderTuple.DisplayName,
65 Attributes = (int)wixDependencyProviderTuple.Attributes 65 Attributes = (int)wixDependencyProviderTuple.Attributes
66 }; 66 });
67 67
68 if (String.IsNullOrEmpty(dependency.Key)) 68 if (String.IsNullOrEmpty(dependency.Key))
69 { 69 {
@@ -94,8 +94,6 @@ namespace WixToolset.Core.Burn.Bind
94 { 94 {
95 dependency.DisplayName = facade.PackageTuple.DisplayName; 95 dependency.DisplayName = facade.PackageTuple.DisplayName;
96 } 96 }
97
98 this.Section.Tuples.Add(dependency);
99 } 97 }
100 } 98 }
101 99
@@ -121,15 +119,13 @@ namespace WixToolset.Core.Burn.Bind
121 119
122 if (!String.IsNullOrEmpty(key) && !this.DependencyTuplesByKey.ContainsKey(key)) 120 if (!String.IsNullOrEmpty(key) && !this.DependencyTuplesByKey.ContainsKey(key))
123 { 121 {
124 var dependency = new ProvidesDependencyTuple(facade.PackageTuple.SourceLineNumbers, facade.PackageTuple.Id) 122 var dependency = this.Section.AddTuple(new ProvidesDependencyTuple(facade.PackageTuple.SourceLineNumbers, facade.PackageTuple.Id)
125 { 123 {
126 PackageRef = facade.PackageId, 124 PackageRef = facade.PackageId,
127 Key = key, 125 Key = key,
128 Version = facade.PackageTuple.Version, 126 Version = facade.PackageTuple.Version,
129 DisplayName = facade.PackageTuple.DisplayName 127 DisplayName = facade.PackageTuple.DisplayName
130 }; 128 });
131
132 this.Section.Tuples.Add(dependency);
133 129
134 this.DependencyTuplesByKey.Add(dependency.Key, dependency); 130 this.DependencyTuplesByKey.Add(dependency.Key, dependency);
135 } 131 }
diff --git a/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs b/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs
index b3a29e15..6e08c68e 100644
--- a/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/AutomaticallySlipstreamPatchesCommand.cs
@@ -102,17 +102,12 @@ namespace WixToolset.Core.Burn.Bundles
102 102
103 if (slipstreamMspIds.Add(id.Id)) 103 if (slipstreamMspIds.Add(id.Id))
104 { 104 {
105 var slipstreamTuple = new WixBundleSlipstreamMspTuple(patchTargetCode.SourceLineNumbers) 105 this.Section.AddTuple(new WixBundleSlipstreamMspTuple(patchTargetCode.SourceLineNumbers)
106 { 106 {
107 TargetPackageRef = msiPackage.Id.Id, 107 TargetPackageRef = msiPackage.Id.Id,
108 MspPackageRef = patchTargetCode.PackageRef 108 MspPackageRef = patchTargetCode.PackageRef,
109 }; 109 });
110 110
111 //var slipstreamMspRow = SlipstreamMspTable.CreateRow(tuple.SourceLineNumbers, false);
112 //slipstreamMspRow[0] = msi.ChainPackageId;
113 //slipstreamMspRow[1] = tuple.MspPackageId;
114
115 this.Section.Tuples.Add(slipstreamTuple);
116 return true; 111 return true;
117 } 112 }
118 113
diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
index 1ef5bb2e..5ef75b3e 100644
--- a/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/CreateBootstrapperApplicationManifestCommand.cs
@@ -285,7 +285,7 @@ namespace WixToolset.Core.Burn.Bundles
285 { 285 {
286 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BADataFileName); 286 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BADataFileName);
287 287
288 var tuple = new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId)) 288 var tuple = this.Section.AddTuple(new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
289 { 289 {
290 Name = BurnCommon.BADataFileName, 290 Name = BurnCommon.BADataFileName,
291 SourceFile = new IntermediateFieldPathValue { Path = baManifestPath }, 291 SourceFile = new IntermediateFieldPathValue { Path = baManifestPath },
@@ -294,7 +294,7 @@ namespace WixToolset.Core.Burn.Bundles
294 ContainerRef = BurnConstants.BurnUXContainerName, 294 ContainerRef = BurnConstants.BurnUXContainerName,
295 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex), 295 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex),
296 Packaging = PackagingType.Embedded, 296 Packaging = PackagingType.Embedded,
297 }; 297 });
298 298
299 var fileInfo = new FileInfo(baManifestPath); 299 var fileInfo = new FileInfo(baManifestPath);
300 300
@@ -302,8 +302,6 @@ namespace WixToolset.Core.Burn.Bundles
302 302
303 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo); 303 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo);
304 304
305 this.Section.Tuples.Add(tuple);
306
307 return tuple; 305 return tuple;
308 } 306 }
309 } 307 }
diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs
index b608c03d..73ad5174 100644
--- a/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/CreateBundleExtensionManifestCommand.cs
@@ -124,7 +124,7 @@ namespace WixToolset.Core.Burn.Bundles
124 { 124 {
125 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BundleExtensionDataFileName); 125 var generatedId = Common.GenerateIdentifier("ux", BurnCommon.BundleExtensionDataFileName);
126 126
127 var tuple = new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId)) 127 var tuple = this.Section.AddTuple(new WixBundlePayloadTuple(this.BundleTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
128 { 128 {
129 Name = BurnCommon.BundleExtensionDataFileName, 129 Name = BurnCommon.BundleExtensionDataFileName,
130 SourceFile = new IntermediateFieldPathValue { Path = bextManifestPath }, 130 SourceFile = new IntermediateFieldPathValue { Path = bextManifestPath },
@@ -133,7 +133,7 @@ namespace WixToolset.Core.Burn.Bundles
133 ContainerRef = BurnConstants.BurnUXContainerName, 133 ContainerRef = BurnConstants.BurnUXContainerName,
134 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex), 134 EmbeddedId = String.Format(CultureInfo.InvariantCulture, BurnCommon.BurnUXContainerEmbeddedIdFormat, this.LastUXPayloadIndex),
135 Packaging = PackagingType.Embedded, 135 Packaging = PackagingType.Embedded,
136 }; 136 });
137 137
138 var fileInfo = new FileInfo(bextManifestPath); 138 var fileInfo = new FileInfo(bextManifestPath);
139 139
@@ -141,8 +141,6 @@ namespace WixToolset.Core.Burn.Bundles
141 141
142 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo); 142 tuple.Hash = BundleHashAlgorithm.Hash(fileInfo);
143 143
144 this.Section.Tuples.Add(tuple);
145
146 return tuple; 144 return tuple;
147 } 145 }
148 } 146 }
diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs
index d800a19a..0754fbc6 100644
--- a/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs
@@ -283,7 +283,7 @@ namespace WixToolset.Core.Burn.Bundles
283 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive ? WixBundleRelatedPackageAttributes.MaxInclusive : 0; 283 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive ? WixBundleRelatedPackageAttributes.MaxInclusive : 0;
284 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive ? WixBundleRelatedPackageAttributes.LangInclusive : 0; 284 attributes |= (recordAttributes & WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive) == WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive ? WixBundleRelatedPackageAttributes.LangInclusive : 0;
285 285
286 var related = new WixBundleRelatedPackageTuple(this.Facade.PackageTuple.SourceLineNumbers) 286 this.Section.AddTuple(new WixBundleRelatedPackageTuple(this.Facade.PackageTuple.SourceLineNumbers)
287 { 287 {
288 PackageRef = this.Facade.PackageId, 288 PackageRef = this.Facade.PackageId,
289 RelatedId = record.GetString(1), 289 RelatedId = record.GetString(1),
@@ -291,7 +291,7 @@ namespace WixToolset.Core.Burn.Bundles
291 MaxVersion = record.GetString(3), 291 MaxVersion = record.GetString(3),
292 Languages = record.GetString(4), 292 Languages = record.GetString(4),
293 Attributes = attributes, 293 Attributes = attributes,
294 }; 294 });
295 } 295 }
296 } 296 }
297 } 297 }
@@ -358,7 +358,7 @@ namespace WixToolset.Core.Burn.Bundles
358 } 358 }
359 } 359 }
360 360
361 var feature = new WixBundleMsiFeatureTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, this.Facade.PackageId, featureName)) 361 this.Section.AddTuple(new WixBundleMsiFeatureTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, this.Facade.PackageId, featureName))
362 { 362 {
363 PackageRef = this.Facade.PackageId, 363 PackageRef = this.Facade.PackageId,
364 Name = featureName, 364 Name = featureName,
@@ -370,7 +370,7 @@ namespace WixToolset.Core.Burn.Bundles
370 Directory = allFeaturesResultRecord.GetString(7), 370 Directory = allFeaturesResultRecord.GetString(7),
371 Attributes = allFeaturesResultRecord.GetInteger(8), 371 Attributes = allFeaturesResultRecord.GetInteger(8),
372 Size = size 372 Size = size
373 }; 373 });
374 } 374 }
375 } 375 }
376 } 376 }
@@ -397,7 +397,7 @@ namespace WixToolset.Core.Burn.Bundles
397 var generatedId = Common.GenerateIdentifier("cab", packagePayload.Id.Id, cabinet); 397 var generatedId = Common.GenerateIdentifier("cab", packagePayload.Id.Id, cabinet);
398 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, cabinet, "Cabinet", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal); 398 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, cabinet, "Cabinet", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal);
399 399
400 var tuple = new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId)) 400 this.Section.AddTuple(new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
401 { 401 {
402 Name = cabinetName, 402 Name = cabinetName,
403 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile }, 403 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile },
@@ -409,9 +409,7 @@ namespace WixToolset.Core.Burn.Bundles
409 EnableSignatureValidation = packagePayload.EnableSignatureValidation, 409 EnableSignatureValidation = packagePayload.EnableSignatureValidation,
410 Packaging = packagePayload.Packaging, 410 Packaging = packagePayload.Packaging,
411 ParentPackagePayloadRef = packagePayload.Id.Id, 411 ParentPackagePayloadRef = packagePayload.Id.Id,
412 }; 412 });
413
414 this.Section.Tuples.Add(tuple);
415 } 413 }
416 } 414 }
417 } 415 }
@@ -477,7 +475,7 @@ namespace WixToolset.Core.Burn.Bundles
477 var generatedId = Common.GenerateIdentifier("f", packagePayload.Id.Id, record.GetString(2)); 475 var generatedId = Common.GenerateIdentifier("f", packagePayload.Id.Id, record.GetString(2));
478 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, fileSourcePath, "File", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal); 476 var payloadSourceFile = this.ResolveRelatedFile(packagePayload.SourceFile.Path, packagePayload.UnresolvedSourceFile, fileSourcePath, "File", this.Facade.PackageTuple.SourceLineNumbers, BindStage.Normal);
479 477
480 var tuple = new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId)) 478 this.Section.AddTuple(new WixBundlePayloadTuple(this.Facade.PackageTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, generatedId))
481 { 479 {
482 Name = name, 480 Name = name,
483 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile }, 481 SourceFile = new IntermediateFieldPathValue { Path = payloadSourceFile },
@@ -489,9 +487,7 @@ namespace WixToolset.Core.Burn.Bundles
489 EnableSignatureValidation = packagePayload.EnableSignatureValidation, 487 EnableSignatureValidation = packagePayload.EnableSignatureValidation,
490 Packaging = packagePayload.Packaging, 488 Packaging = packagePayload.Packaging,
491 ParentPackagePayloadRef = packagePayload.Id.Id, 489 ParentPackagePayloadRef = packagePayload.Id.Id,
492 }; 490 });
493
494 this.Section.Tuples.Add(tuple);
495 } 491 }
496 } 492 }
497 493
@@ -506,14 +502,12 @@ namespace WixToolset.Core.Burn.Bundles
506 502
507 private void AddMsiProperty(WixBundleMsiPackageTuple msiPackage, string name, string value) 503 private void AddMsiProperty(WixBundleMsiPackageTuple msiPackage, string name, string value)
508 { 504 {
509 var tuple = new WixBundleMsiPropertyTuple(msiPackage.SourceLineNumbers, new Identifier(AccessModifier.Private, msiPackage.Id.Id, name)) 505 this.Section.AddTuple(new WixBundleMsiPropertyTuple(msiPackage.SourceLineNumbers, new Identifier(AccessModifier.Private, msiPackage.Id.Id, name))
510 { 506 {
511 PackageRef = msiPackage.Id.Id, 507 PackageRef = msiPackage.Id.Id,
512 Name = name, 508 Name = name,
513 Value = value 509 Value = value,
514 }; 510 });
515
516 this.Section.Tuples.Add(tuple);
517 } 511 }
518 512
519 private void ImportDependencyProviders(WixBundleMsiPackageTuple msiPackage, Dtf.Database db) 513 private void ImportDependencyProviders(WixBundleMsiPackageTuple msiPackage, Dtf.Database db)
@@ -535,7 +529,7 @@ namespace WixToolset.Core.Burn.Bundles
535 } 529 }
536 530
537 // Import the provider key and attributes. 531 // Import the provider key and attributes.
538 var tuple = new ProvidesDependencyTuple(msiPackage.SourceLineNumbers) 532 this.Section.AddTuple(new ProvidesDependencyTuple(msiPackage.SourceLineNumbers)
539 { 533 {
540 PackageRef = msiPackage.Id.Id, 534 PackageRef = msiPackage.Id.Id,
541 Key = record.GetString(1), 535 Key = record.GetString(1),
@@ -543,9 +537,7 @@ namespace WixToolset.Core.Burn.Bundles
543 DisplayName = record.GetString(3) ?? this.Facade.PackageTuple.DisplayName, 537 DisplayName = record.GetString(3) ?? this.Facade.PackageTuple.DisplayName,
544 Attributes = record.GetInteger(4), 538 Attributes = record.GetInteger(4),
545 Imported = true 539 Imported = true
546 }; 540 });
547
548 this.Section.Tuples.Add(tuple);
549 } 541 }
550 } 542 }
551 } 543 }
diff --git a/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs b/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs
index dc832d40..5acffe33 100644
--- a/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/ProcessMspPackageCommand.cs
@@ -127,14 +127,12 @@ namespace WixToolset.Core.Burn.Bundles
127 127
128 if (uniqueTargetCodes.Add(targetCode)) 128 if (uniqueTargetCodes.Add(targetCode))
129 { 129 {
130 var tuple = new WixBundlePatchTargetCodeTuple(packagePayload.SourceLineNumbers) 130 this.Section.AddTuple(new WixBundlePatchTargetCodeTuple(packagePayload.SourceLineNumbers)
131 { 131 {
132 PackageRef = packagePayload.Id.Id, 132 PackageRef = packagePayload.Id.Id,
133 TargetCode = targetCode, 133 TargetCode = targetCode,
134 Attributes = attributes 134 Attributes = attributes
135 }; 135 });
136
137 this.Section.Tuples.Add(tuple);
138 } 136 }
139 } 137 }
140 138
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs
index 6cc4153f..ba844da4 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs
@@ -26,13 +26,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
26 { 26 {
27 if (!createFolderTuplesByComponentRef.Contains(componentTuple.Id.Id)) 27 if (!createFolderTuplesByComponentRef.Contains(componentTuple.Id.Id))
28 { 28 {
29 var createFolderTuple = new CreateFolderTuple(componentTuple.SourceLineNumbers) 29 this.Section.AddTuple(new CreateFolderTuple(componentTuple.SourceLineNumbers)
30 { 30 {
31 DirectoryRef = componentTuple.DirectoryRef, 31 DirectoryRef = componentTuple.DirectoryRef,
32 ComponentRef = componentTuple.Id.Id, 32 ComponentRef = componentTuple.Id.Id,
33 }; 33 });
34
35 this.Section.Tuples.Add(createFolderTuple);
36 } 34 }
37 } 35 }
38 } 36 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
index 2bfd587f..ae7e5788 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
@@ -71,12 +71,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
71 // When building merge module, all the files go to "#MergeModule.CABinet". 71 // When building merge module, all the files go to "#MergeModule.CABinet".
72 if (SectionType.Module == this.Section.Type) 72 if (SectionType.Module == this.Section.Type)
73 { 73 {
74 var mergeModuleMediaRow = new MediaTuple(); 74 var mergeModuleMediaTuple = this.Section.AddTuple(new MediaTuple
75 mergeModuleMediaRow.Cabinet = "#MergeModule.CABinet"; 75 {
76 76 Cabinet = "#MergeModule.CABinet",
77 this.Section.Tuples.Add(mergeModuleMediaRow); 77 });
78 78
79 filesByCabinetMedia.Add(mergeModuleMediaRow, new List<FileFacade>(this.FileFacades)); 79 filesByCabinetMedia.Add(mergeModuleMediaTuple, new List<FileFacade>(this.FileFacades));
80 } 80 }
81 else if (mediaTemplateTable.Count == 0) 81 else if (mediaTemplateTable.Count == 0)
82 { 82 {
@@ -212,13 +212,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
212 // If there are uncompressed files and no MediaRow, create a default one. 212 // If there are uncompressed files and no MediaRow, create a default one.
213 if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any()) 213 if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any())
214 { 214 {
215 var defaultMediaRow = new MediaTuple(null, new Identifier(AccessModifier.Private, 1)) 215 var defaultMediaRow = this.Section.AddTuple(new MediaTuple(null, new Identifier(AccessModifier.Private, 1))
216 { 216 {
217 DiskId = 1 217 DiskId = 1,
218 }; 218 });
219 219
220 mediaRows.Add(1, defaultMediaRow); 220 mediaRows.Add(1, defaultMediaRow);
221 this.Section.Tuples.Add(defaultMediaRow);
222 } 221 }
223 } 222 }
224 223
@@ -298,14 +297,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
298 /// <returns></returns> 297 /// <returns></returns>
299 private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex) 298 private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex)
300 { 299 {
301 var currentMediaTuple = new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex)); 300 return this.Section.AddTuple(new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex))
302 currentMediaTuple.DiskId = cabIndex; 301 {
303 currentMediaTuple.Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex); 302 DiskId = cabIndex,
304 currentMediaTuple.CompressionLevel = mediaTemplateTuple.CompressionLevel; 303 Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex),
305 304 CompressionLevel = mediaTemplateTuple.CompressionLevel,
306 this.Section.Tuples.Add(currentMediaTuple); 305 });
307
308 return currentMediaTuple;
309 } 306 }
310 } 307 }
311} 308}
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
index f4fa510f..ca6bfd2f 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
@@ -225,7 +225,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
225 // Put the summary information that was extracted back in now that it is updated. 225 // Put the summary information that was extracted back in now that it is updated.
226 foreach (var readSummaryInfo in summaryInfo.Values.OrderBy(s => s.PropertyId)) 226 foreach (var readSummaryInfo in summaryInfo.Values.OrderBy(s => s.PropertyId))
227 { 227 {
228 section.Tuples.Add(readSummaryInfo); 228 section.AddTuple(readSummaryInfo);
229 } 229 }
230 230
231 this.SubStorages = subStorages; 231 this.SubStorages = subStorages;
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs
index 8aa6047f..7a9dbc69 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs
@@ -44,10 +44,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
44 this.InstallerVersion = 0; 44 this.InstallerVersion = 0;
45 this.ModularizationGuid = null; 45 this.ModularizationGuid = null;
46 46
47 bool foundCreateDataTime = false; 47 var foundCreateDataTime = false;
48 bool foundLastSaveDataTime = false; 48 var foundLastSaveDataTime = false;
49 bool foundCreatingApplication = false; 49 var foundCreatingApplication = false;
50 string now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); 50 var now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
51 51
52 foreach (var summaryInformationTuple in this.Section.Tuples.OfType<SummaryInformationTuple>()) 52 foreach (var summaryInformationTuple in this.Section.Tuples.OfType<SummaryInformationTuple>())
53 { 53 {
@@ -110,31 +110,31 @@ namespace WixToolset.Core.WindowsInstaller.Bind
110 // add a summary information row for the create time/date property if its not already set 110 // add a summary information row for the create time/date property if its not already set
111 if (!foundCreateDataTime) 111 if (!foundCreateDataTime)
112 { 112 {
113 var createTimeDateRow = new SummaryInformationTuple(null); 113 this.Section.AddTuple(new SummaryInformationTuple(null)
114 createTimeDateRow.PropertyId = SumaryInformationType.Created; 114 {
115 createTimeDateRow.Value = now; 115 PropertyId = SumaryInformationType.Created,
116 116 Value = now,
117 this.Section.Tuples.Add(createTimeDateRow); 117 });
118 } 118 }
119 119
120 // add a summary information row for the last save time/date property if its not already set 120 // add a summary information row for the last save time/date property if its not already set
121 if (!foundLastSaveDataTime) 121 if (!foundLastSaveDataTime)
122 { 122 {
123 var lastSaveTimeDateRow = new SummaryInformationTuple(null); 123 this.Section.AddTuple(new SummaryInformationTuple(null)
124 lastSaveTimeDateRow.PropertyId = SumaryInformationType.LastSaved; 124 {
125 lastSaveTimeDateRow.Value = now; 125 PropertyId = SumaryInformationType.LastSaved,
126 126 Value = now,
127 this.Section.Tuples.Add(lastSaveTimeDateRow); 127 });
128 } 128 }
129 129
130 // add a summary information row for the creating application property if its not already set 130 // add a summary information row for the creating application property if its not already set
131 if (!foundCreatingApplication) 131 if (!foundCreatingApplication)
132 { 132 {
133 var creatingApplicationRow = new SummaryInformationTuple(null); 133 this.Section.AddTuple(new SummaryInformationTuple(null)
134 creatingApplicationRow.PropertyId = SumaryInformationType.CreatingApplication; 134 {
135 creatingApplicationRow.Value = String.Format(CultureInfo.InvariantCulture, AppCommon.GetCreatingApplicationString()); 135 PropertyId = SumaryInformationType.CreatingApplication,
136 136 Value = String.Format(CultureInfo.InvariantCulture, AppCommon.GetCreatingApplicationString()),
137 this.Section.Tuples.Add(creatingApplicationRow); 137 });
138 } 138 }
139 } 139 }
140 } 140 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
index 0d165f80..5b4fe9e5 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs
@@ -57,26 +57,26 @@ namespace WixToolset.Core.WindowsInstaller.Bind
57 57
58 if (0 < adminProperties.Count) 58 if (0 < adminProperties.Count)
59 { 59 {
60 var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties")); 60 this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties"))
61 tuple.Value = String.Join(";", adminProperties); 61 {
62 62 Value = String.Join(";", adminProperties),
63 this.Section.Tuples.Add(tuple); 63 });
64 } 64 }
65 65
66 if (0 < secureProperties.Count) 66 if (0 < secureProperties.Count)
67 { 67 {
68 var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "SecureCustomProperties")); 68 this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "SecureCustomProperties"))
69 tuple.Value = String.Join(";", secureProperties); 69 {
70 70 Value = String.Join(";", secureProperties),
71 this.Section.Tuples.Add(tuple); 71 });
72 } 72 }
73 73
74 if (0 < hiddenProperties.Count) 74 if (0 < hiddenProperties.Count)
75 { 75 {
76 var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "MsiHiddenProperties")); 76 this.Section.AddTuple(new PropertyTuple(null, new Identifier(AccessModifier.Private, "MsiHiddenProperties"))
77 tuple.Value = String.Join(";", hiddenProperties); 77 {
78 78 Value = String.Join(";", hiddenProperties)
79 this.Section.Tuples.Add(tuple); 79 });
80 } 80 }
81 } 81 }
82 } 82 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
index fe014b0b..a5055209 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
@@ -186,7 +186,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
186 186
187 foreach (var action in scheduledActionTuples) 187 foreach (var action in scheduledActionTuples)
188 { 188 {
189 this.Section.Tuples.Add(action); 189 this.Section.AddTuple(action);
190 } 190 }
191 } 191 }
192 192
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
index 81d46b41..7ecd58d7 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
@@ -158,8 +158,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
158 158
159 if (null == facade.Hash) 159 if (null == facade.Hash)
160 { 160 {
161 facade.Hash = new MsiFileHashTuple(facade.SourceLineNumber, facade.Identifier); 161 facade.Hash = this.Section.AddTuple(new MsiFileHashTuple(facade.SourceLineNumber, facade.Identifier));
162 this.Section.Tuples.Add(facade.Hash);
163 } 162 }
164 163
165 facade.Hash.Options = 0; 164 facade.Hash.Options = 0;
@@ -337,23 +336,24 @@ namespace WixToolset.Core.WindowsInstaller.Bind
337 336
338 // override directly authored value 337 // override directly authored value
339 var lookup = String.Concat(facade.ComponentRef, "/", name); 338 var lookup = String.Concat(facade.ComponentRef, "/", name);
340 if (!assemblyNameTuples.TryGetValue(lookup, out var assemblyNameRow)) 339 if (!assemblyNameTuples.TryGetValue(lookup, out var assemblyNameTuple))
341 { 340 {
342 assemblyNameRow = new MsiAssemblyNameTuple(facade.SourceLineNumber); 341 assemblyNameTuple = this.Section.AddTuple(new MsiAssemblyNameTuple(facade.SourceLineNumber)
343 assemblyNameRow.ComponentRef = facade.ComponentRef; 342 {
344 assemblyNameRow.Name = name; 343 ComponentRef = facade.ComponentRef,
345 assemblyNameRow.Value = value; 344 Name = name,
345 Value = value,
346 });
346 347
347 if (null == facade.AssemblyNames) 348 if (null == facade.AssemblyNames)
348 { 349 {
349 facade.AssemblyNames = new List<MsiAssemblyNameTuple>(); 350 facade.AssemblyNames = new List<MsiAssemblyNameTuple>();
350 } 351 }
351 352
352 facade.AssemblyNames.Add(assemblyNameRow); 353 facade.AssemblyNames.Add(assemblyNameTuple);
353 this.Section.Tuples.Add(assemblyNameRow);
354 } 354 }
355 355
356 assemblyNameRow.Value = value; 356 assemblyNameTuple.Value = value;
357 357
358 if (this.VariableCache != null) 358 if (this.VariableCache != null)
359 { 359 {
diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs
index e6dd538b..a670714a 100644
--- a/src/WixToolset.Core/Binder.cs
+++ b/src/WixToolset.Core/Binder.cs
@@ -81,16 +81,16 @@ namespace WixToolset.Core
81 var executingAssembly = Assembly.GetExecutingAssembly(); 81 var executingAssembly = Assembly.GetExecutingAssembly();
82 var fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location); 82 var fileVersion = FileVersionInfo.GetVersionInfo(executingAssembly.Location);
83 83
84 var buildInfoTuple = new WixBuildInfoTuple(); 84 var buildInfoTuple = entrySection.AddTuple(new WixBuildInfoTuple()
85 buildInfoTuple.WixVersion = fileVersion.FileVersion; 85 {
86 buildInfoTuple.WixOutputFile = outputFile; 86 WixVersion = fileVersion.FileVersion,
87 WixOutputFile = outputFile,
88 });
87 89
88 if (!String.IsNullOrEmpty(outputPdbPath)) 90 if (!String.IsNullOrEmpty(outputPdbPath))
89 { 91 {
90 buildInfoTuple.WixPdbFile = outputPdbPath; 92 buildInfoTuple.WixPdbFile = outputPdbPath;
91 } 93 }
92
93 entrySection.Tuples.Add(buildInfoTuple);
94 } 94 }
95 } 95 }
96} 96}
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index 9db938e1..d4ad3279 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -12,6 +12,7 @@ namespace WixToolset.Core
12 using System.Xml.Linq; 12 using System.Xml.Linq;
13 using WixToolset.Data; 13 using WixToolset.Data;
14 using WixToolset.Data.Tuples; 14 using WixToolset.Data.Tuples;
15 using WixToolset.Data.WindowsInstaller;
15 using WixToolset.Extensibility; 16 using WixToolset.Extensibility;
16 using WixToolset.Extensibility.Data; 17 using WixToolset.Extensibility.Data;
17 using WixToolset.Extensibility.Services; 18 using WixToolset.Extensibility.Services;
@@ -163,7 +164,7 @@ namespace WixToolset.Core
163 this.Core = null; 164 this.Core = null;
164 } 165 }
165 166
166 target.UpdateLevel(IntermediateLevels.Compiled); 167 target.UpdateLevel(Data.IntermediateLevels.Compiled);
167 168
168 return this.Messaging.EncounteredError ? null : target; 169 return this.Messaging.EncounteredError ? null : target;
169 } 170 }
@@ -324,13 +325,11 @@ namespace WixToolset.Core
324 this.Core.Write(ErrorMessages.SearchPropertyNotUppercase(sourceLineNumbers, "Property", "Id", propertyId.Id)); 325 this.Core.Write(ErrorMessages.SearchPropertyNotUppercase(sourceLineNumbers, "Property", "Id", propertyId.Id));
325 } 326 }
326 327
327 var tuple = new AppSearchTuple(sourceLineNumbers, new Identifier(propertyId.Access, propertyId.Id, signature)) 328 this.Core.AddTuple(new AppSearchTuple(sourceLineNumbers, new Identifier(propertyId.Access, propertyId.Id, signature))
328 { 329 {
329 PropertyRef = propertyId.Id, 330 PropertyRef = propertyId.Id,
330 SignatureRef = signature 331 SignatureRef = signature
331 }; 332 });
332
333 this.Core.AddTuple(tuple);
334 } 333 }
335 } 334 }
336 335
@@ -371,7 +370,7 @@ namespace WixToolset.Core
371 { 370 {
372 var section = this.Core.ActiveSection; 371 var section = this.Core.ActiveSection;
373 372
374 // Add the row to a separate section if requested. 373 // Add the tuple to a separate section if requested.
375 if (fragment) 374 if (fragment)
376 { 375 {
377 var id = String.Concat(this.Core.ActiveSection.Id, ".", propertyId.Id); 376 var id = String.Concat(this.Core.ActiveSection.Id, ".", propertyId.Id);
@@ -379,26 +378,24 @@ namespace WixToolset.Core
379 section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId); 378 section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId);
380 379
381 // Reference the property in the active section. 380 // Reference the property in the active section.
382 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", propertyId.Id); 381 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, propertyId.Id);
383 } 382 }
384 383
385 // Allow row to exist with no value so that PropertyRefs can be made for *Search elements 384 // Allow tuple to exist with no value so that PropertyRefs can be made for *Search elements
386 // the linker will remove these rows before the final output is created. 385 // the linker will remove these tuples before the final output is created.
387 var tuple = new PropertyTuple(sourceLineNumbers, propertyId) 386 section.AddTuple(new PropertyTuple(sourceLineNumbers, propertyId)
388 { 387 {
389 Value = value, 388 Value = value,
390 }; 389 });
391
392 section.Tuples.Add(tuple);
393 390
394 if (admin || hidden || secure) 391 if (admin || hidden || secure)
395 { 392 {
396 this.AddWixPropertyRow(sourceLineNumbers, propertyId, admin, secure, hidden, section); 393 this.AddWixPropertyTuple(sourceLineNumbers, propertyId, admin, secure, hidden, section);
397 } 394 }
398 } 395 }
399 } 396 }
400 397
401 private void AddWixPropertyRow(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, IntermediateSection section = null) 398 private void AddWixPropertyTuple(SourceLineNumber sourceLineNumbers, Identifier property, bool admin, bool secure, bool hidden, IntermediateSection section = null)
402 { 399 {
403 if (secure && property.Id != property.Id.ToUpperInvariant()) 400 if (secure && property.Id != property.Id.ToUpperInvariant())
404 { 401 {
@@ -409,18 +406,16 @@ namespace WixToolset.Core
409 { 406 {
410 section = this.Core.ActiveSection; 407 section = this.Core.ActiveSection;
411 408
412 this.Core.EnsureTable(sourceLineNumbers, "Property"); // Property table is always required when using WixProperty table. 409 this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Property); // Property table is always required when using WixProperty table.
413 } 410 }
414 411
415 var tuple = new WixPropertyTuple(sourceLineNumbers) 412 section.AddTuple(new WixPropertyTuple(sourceLineNumbers)
416 { 413 {
417 PropertyRef = property.Id, 414 PropertyRef = property.Id,
418 Admin = admin, 415 Admin = admin,
419 Hidden = hidden, 416 Hidden = hidden,
420 Secure = secure 417 Secure = secure
421 }; 418 });
422
423 section.Tuples.Add(tuple);
424 } 419 }
425 420
426 /// <summary> 421 /// <summary>
@@ -550,7 +545,7 @@ namespace WixToolset.Core
550 545
551 if (!this.Core.EncounteredError) 546 if (!this.Core.EncounteredError)
552 { 547 {
553 var tuple = new AppIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, appId)) 548 this.Core.AddTuple(new AppIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, appId))
554 { 549 {
555 AppId = appId, 550 AppId = appId,
556 RemoteServerName = remoteServerName, 551 RemoteServerName = remoteServerName,
@@ -558,10 +553,8 @@ namespace WixToolset.Core
558 ServiceParameters = serviceParameters, 553 ServiceParameters = serviceParameters,
559 DllSurrogate = dllSurrogate, 554 DllSurrogate = dllSurrogate,
560 ActivateAtStorage = activateAtStorage, 555 ActivateAtStorage = activateAtStorage,
561 RunAsInteractiveUser = runAsInteractiveUser 556 RunAsInteractiveUser = runAsInteractiveUser,
562 }; 557 });
563
564 this.Core.AddTuple(tuple);
565 } 558 }
566 } 559 }
567 else if (YesNoType.No == advertise) 560 else if (YesNoType.No == advertise)
@@ -650,14 +643,12 @@ namespace WixToolset.Core
650 643
651 if (!this.Core.EncounteredError) 644 if (!this.Core.EncounteredError)
652 { 645 {
653 var tuple = new MsiAssemblyNameTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, componentId, id)) 646 this.Core.AddTuple(new MsiAssemblyNameTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, componentId, id))
654 { 647 {
655 ComponentRef = componentId, 648 ComponentRef = componentId,
656 Name = id, 649 Name = id,
657 Value = value 650 Value = value,
658 }; 651 });
659
660 this.Core.AddTuple(tuple);
661 } 652 }
662 } 653 }
663 654
@@ -739,12 +730,10 @@ namespace WixToolset.Core
739 730
740 if (!this.Core.EncounteredError) 731 if (!this.Core.EncounteredError)
741 { 732 {
742 var tuple = new BinaryTuple(sourceLineNumbers, id) 733 var tuple = this.Core.AddTuple(new BinaryTuple(sourceLineNumbers, id)
743 { 734 {
744 Data = new IntermediateFieldPathValue { Path = sourceFile } 735 Data = new IntermediateFieldPathValue { Path = sourceFile }
745 }; 736 });
746
747 this.Core.AddTuple(tuple);
748 737
749 if (YesNoType.Yes == suppressModularization) 738 if (YesNoType.Yes == suppressModularization)
750 { 739 {
@@ -820,7 +809,7 @@ namespace WixToolset.Core
820 { 809 {
821 this.Core.AddTuple(new IconTuple(sourceLineNumbers, id) 810 this.Core.AddTuple(new IconTuple(sourceLineNumbers, id)
822 { 811 {
823 Data = new IntermediateFieldPathValue { Path = sourceFile } 812 Data = new IntermediateFieldPathValue { Path = sourceFile },
824 }); 813 });
825 } 814 }
826 815
@@ -844,7 +833,7 @@ namespace WixToolset.Core
844 { 833 {
845 case "Property": 834 case "Property":
846 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 835 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
847 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); 836 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, property);
848 break; 837 break;
849 default: 838 default:
850 this.Core.UnexpectedAttribute(node, attrib); 839 this.Core.UnexpectedAttribute(node, attrib);
@@ -940,15 +929,13 @@ namespace WixToolset.Core
940 929
941 if (!this.Core.EncounteredError) 930 if (!this.Core.EncounteredError)
942 { 931 {
943 var tuple = new WixInstanceTransformsTuple(sourceLineNumbers, id) 932 this.Core.AddTuple(new WixInstanceTransformsTuple(sourceLineNumbers, id)
944 { 933 {
945 PropertyId = propertyId, 934 PropertyId = propertyId,
946 ProductCode = productCode, 935 ProductCode = productCode,
947 ProductName = productName, 936 ProductName = productName,
948 UpgradeCode = upgradeCode 937 UpgradeCode = upgradeCode
949 }; 938 });
950
951 this.Core.AddTuple(tuple);
952 } 939 }
953 } 940 }
954 941
@@ -979,7 +966,7 @@ namespace WixToolset.Core
979 break; 966 break;
980 case "Feature": 967 case "Feature":
981 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 968 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
982 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); 969 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, feature);
983 break; 970 break;
984 case "Qualifier": 971 case "Qualifier":
985 qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 972 qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -1009,16 +996,14 @@ namespace WixToolset.Core
1009 996
1010 if (!this.Core.EncounteredError) 997 if (!this.Core.EncounteredError)
1011 { 998 {
1012 var tuple = new PublishComponentTuple(sourceLineNumbers) 999 this.Core.AddTuple(new PublishComponentTuple(sourceLineNumbers)
1013 { 1000 {
1014 ComponentId = id, 1001 ComponentId = id,
1015 Qualifier = qualifier, 1002 Qualifier = qualifier,
1016 ComponentRef = componentId, 1003 ComponentRef = componentId,
1017 AppData = appData, 1004 AppData = appData,
1018 FeatureRef = feature ?? Guid.Empty.ToString("B"), 1005 FeatureRef = feature ?? Guid.Empty.ToString("B"),
1019 }; 1006 });
1020
1021 this.Core.AddTuple(tuple);
1022 } 1007 }
1023 } 1008 }
1024 1009
@@ -1195,7 +1180,7 @@ namespace WixToolset.Core
1195 1180
1196 if (!String.IsNullOrEmpty(localFileServer)) 1181 if (!String.IsNullOrEmpty(localFileServer))
1197 { 1182 {
1198 this.Core.CreateSimpleReference(sourceLineNumbers, "File", localFileServer); 1183 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, localFileServer);
1199 } 1184 }
1200 1185
1201 // Local variables used strictly for child node processing. 1186 // Local variables used strictly for child node processing.
@@ -1268,7 +1253,7 @@ namespace WixToolset.Core
1268 { 1253 {
1269 foreach (var context in contexts) 1254 foreach (var context in contexts)
1270 { 1255 {
1271 var tuple = new ClassTuple(sourceLineNumbers) 1256 var tuple = this.Core.AddTuple(new ClassTuple(sourceLineNumbers)
1272 { 1257 {
1273 CLSID = classId, 1258 CLSID = classId,
1274 Context = context, 1259 Context = context,
@@ -1280,26 +1265,24 @@ namespace WixToolset.Core
1280 Argument = argument, 1265 Argument = argument,
1281 FeatureRef = Guid.Empty.ToString("B"), 1266 FeatureRef = Guid.Empty.ToString("B"),
1282 RelativePath = YesNoType.Yes == relativePath, 1267 RelativePath = YesNoType.Yes == relativePath,
1283 }; 1268 });
1284 1269
1285 if (null != appId) 1270 if (null != appId)
1286 { 1271 {
1287 tuple.AppIdRef = appId; 1272 tuple.AppIdRef = appId;
1288 this.Core.CreateSimpleReference(sourceLineNumbers, "AppId", appId); 1273 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.AppId, appId);
1289 } 1274 }
1290 1275
1291 if (null != icon) 1276 if (null != icon)
1292 { 1277 {
1293 tuple.IconRef = icon; 1278 tuple.IconRef = icon;
1294 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 1279 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
1295 } 1280 }
1296 1281
1297 if (CompilerConstants.IntegerNotSet != iconIndex) 1282 if (CompilerConstants.IntegerNotSet != iconIndex)
1298 { 1283 {
1299 tuple.IconIndex = iconIndex; 1284 tuple.IconIndex = iconIndex;
1300 } 1285 }
1301
1302 this.Core.AddTuple(tuple);
1303 } 1286 }
1304 } 1287 }
1305 } 1288 }
@@ -1379,7 +1362,7 @@ namespace WixToolset.Core
1379 1362
1380 if (null != icon) // ClassId default icon 1363 if (null != icon) // ClassId default icon
1381 { 1364 {
1382 this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon); 1365 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, icon);
1383 1366
1384 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon); 1367 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon);
1385 1368
@@ -1709,7 +1692,7 @@ namespace WixToolset.Core
1709 1692
1710 if (!this.Core.EncounteredError) 1693 if (!this.Core.EncounteredError)
1711 { 1694 {
1712 var tuple = new UpgradeTuple(sourceLineNumbers) 1695 this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
1713 { 1696 {
1714 UpgradeCode = upgradeCode, 1697 UpgradeCode = upgradeCode,
1715 VersionMin = minimum, 1698 VersionMin = minimum,
@@ -1720,9 +1703,7 @@ namespace WixToolset.Core
1720 ExcludeLanguages = excludeLanguages, 1703 ExcludeLanguages = excludeLanguages,
1721 VersionMaxInclusive = maxInclusive, 1704 VersionMaxInclusive = maxInclusive,
1722 VersionMinInclusive = minInclusive, 1705 VersionMinInclusive = minInclusive,
1723 }; 1706 });
1724
1725 this.Core.AddTuple(tuple);
1726 } 1707 }
1727 } 1708 }
1728 1709
@@ -1862,7 +1843,7 @@ namespace WixToolset.Core
1862 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 1843 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1863 } 1844 }
1864 oneChild = true; 1845 oneChild = true;
1865 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 1846 var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
1866 id = new Identifier(AccessModifier.Private, newId); 1847 id = new Identifier(AccessModifier.Private, newId);
1867 signature = null; 1848 signature = null;
1868 break; 1849 break;
@@ -1879,16 +1860,14 @@ namespace WixToolset.Core
1879 1860
1880 if (!this.Core.EncounteredError) 1861 if (!this.Core.EncounteredError)
1881 { 1862 {
1882 var tuple = new RegLocatorTuple(sourceLineNumbers, id) 1863 this.Core.AddTuple(new RegLocatorTuple(sourceLineNumbers, id)
1883 { 1864 {
1884 Root = root.Value, 1865 Root = root.Value,
1885 Key = key, 1866 Key = key,
1886 Name = name, 1867 Name = name,
1887 Type = type.Value, 1868 Type = type.Value,
1888 Win64 = search64bit 1869 Win64 = search64bit,
1889 }; 1870 });
1890
1891 this.Core.AddTuple(tuple);
1892 } 1871 }
1893 1872
1894 return signature; 1873 return signature;
@@ -1912,7 +1891,7 @@ namespace WixToolset.Core
1912 { 1891 {
1913 case "Id": 1892 case "Id":
1914 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1893 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1915 this.Core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id); 1894 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.RegLocator, id);
1916 break; 1895 break;
1917 default: 1896 default:
1918 this.Core.UnexpectedAttribute(node, attrib); 1897 this.Core.UnexpectedAttribute(node, attrib);
@@ -2524,7 +2503,7 @@ namespace WixToolset.Core
2524 // finally add the Component table row 2503 // finally add the Component table row
2525 if (!this.Core.EncounteredError) 2504 if (!this.Core.EncounteredError)
2526 { 2505 {
2527 var tuple = new ComponentTuple(sourceLineNumbers, id) 2506 this.Core.AddTuple(new ComponentTuple(sourceLineNumbers, id)
2528 { 2507 {
2529 ComponentId = guid, 2508 ComponentId = guid,
2530 DirectoryRef = directoryId, 2509 DirectoryRef = directoryId,
@@ -2539,10 +2518,8 @@ namespace WixToolset.Core
2539 Shared = shared, 2518 Shared = shared,
2540 Transitive = transitive, 2519 Transitive = transitive,
2541 UninstallWhenSuperseded = uninstallWhenSuperseded, 2520 UninstallWhenSuperseded = uninstallWhenSuperseded,
2542 Win64 = win64 2521 Win64 = win64,
2543 }; 2522 });
2544
2545 this.Core.AddTuple(tuple);
2546 2523
2547 if (multiInstance) 2524 if (multiInstance)
2548 { 2525 {
@@ -2554,26 +2531,22 @@ namespace WixToolset.Core
2554 2531
2555 if (0 < symbols.Count) 2532 if (0 < symbols.Count)
2556 { 2533 {
2557 var tupleDelaPatch = new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, SymbolPathType.Component, id.Id)) 2534 this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, SymbolPathType.Component, id.Id))
2558 { 2535 {
2559 SymbolType = SymbolPathType.Component, 2536 SymbolType = SymbolPathType.Component,
2560 SymbolId = id.Id, 2537 SymbolId = id.Id,
2561 SymbolPaths = String.Join(";", symbols) 2538 SymbolPaths = String.Join(";", symbols),
2562 }; 2539 });
2563
2564 this.Core.AddTuple(tupleDelaPatch);
2565 } 2540 }
2566 2541
2567 // Complus 2542 // Complus
2568 if (CompilerConstants.IntegerNotSet != comPlusBits) 2543 if (CompilerConstants.IntegerNotSet != comPlusBits)
2569 { 2544 {
2570 var complusTuple = new ComplusTuple(sourceLineNumbers) 2545 this.Core.AddTuple(new ComplusTuple(sourceLineNumbers)
2571 { 2546 {
2572 ComponentRef = id.Id, 2547 ComponentRef = id.Id,
2573 ExpType = comPlusBits, 2548 ExpType = comPlusBits,
2574 }; 2549 });
2575
2576 this.Core.AddTuple(complusTuple);
2577 } 2550 }
2578 2551
2579 // if this is a module, automatically add this component to the references to ensure it gets in the ModuleComponents table 2552 // if this is a module, automatically add this component to the references to ensure it gets in the ModuleComponents table
@@ -2698,7 +2671,7 @@ namespace WixToolset.Core
2698 { 2671 {
2699 case "Id": 2672 case "Id":
2700 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2673 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2701 this.Core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id); 2674 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixComponentGroup, id);
2702 break; 2675 break;
2703 case "Primary": 2676 case "Primary":
2704 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 2677 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -2747,7 +2720,7 @@ namespace WixToolset.Core
2747 { 2720 {
2748 case "Id": 2721 case "Id":
2749 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2722 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2750 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", id); 2723 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Component, id);
2751 break; 2724 break;
2752 case "Primary": 2725 case "Primary":
2753 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 2726 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -2871,7 +2844,7 @@ namespace WixToolset.Core
2871 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 2844 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2872 } 2845 }
2873 oneChild = true; 2846 oneChild = true;
2874 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 2847 var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
2875 id = new Identifier(AccessModifier.Private, newId); 2848 id = new Identifier(AccessModifier.Private, newId);
2876 signature = null; 2849 signature = null;
2877 break; 2850 break;
@@ -2888,18 +2861,12 @@ namespace WixToolset.Core
2888 2861
2889 if (!this.Core.EncounteredError) 2862 if (!this.Core.EncounteredError)
2890 { 2863 {
2891 var tuple = new CompLocatorTuple(sourceLineNumbers, id) 2864 this.Core.AddTuple(new CompLocatorTuple(sourceLineNumbers, id)
2892 { 2865 {
2893 SignatureRef = id.Id, 2866 SignatureRef = id.Id,
2894 ComponentId = componentId, 2867 ComponentId = componentId,
2895 Type = type, 2868 Type = type,
2896 }; 2869 });
2897
2898 this.Core.AddTuple(tuple);
2899
2900 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.CompLocator, id);
2901 //row.Set(1, componentId);
2902 //row.Set(2, type);
2903 } 2870 }
2904 2871
2905 return signature; 2872 return signature;
@@ -2965,13 +2932,11 @@ namespace WixToolset.Core
2965 2932
2966 if (!this.Core.EncounteredError) 2933 if (!this.Core.EncounteredError)
2967 { 2934 {
2968 var tuple = new CreateFolderTuple(sourceLineNumbers) 2935 this.Core.AddTuple(new CreateFolderTuple(sourceLineNumbers)
2969 { 2936 {
2970 DirectoryRef = directoryId, 2937 DirectoryRef = directoryId,
2971 ComponentRef = componentId 2938 ComponentRef = componentId,
2972 }; 2939 });
2973
2974 this.Core.AddTuple(tuple);
2975 } 2940 }
2976 2941
2977 return directoryId; 2942 return directoryId;
@@ -3027,7 +2992,7 @@ namespace WixToolset.Core
3027 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); 2992 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
3028 } 2993 }
3029 fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2994 fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3030 this.Core.CreateSimpleReference(sourceLineNumbers, "File", fileId); 2995 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, fileId);
3031 break; 2996 break;
3032 case "SourceDirectory": 2997 case "SourceDirectory":
3033 sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 2998 sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
@@ -3092,17 +3057,15 @@ namespace WixToolset.Core
3092 3057
3093 if (!this.Core.EncounteredError) 3058 if (!this.Core.EncounteredError)
3094 { 3059 {
3095 var tuple = new MoveFileTuple(sourceLineNumbers, id) 3060 this.Core.AddTuple(new MoveFileTuple(sourceLineNumbers, id)
3096 { 3061 {
3097 ComponentRef = componentId, 3062 ComponentRef = componentId,
3098 SourceName = sourceName, 3063 SourceName = sourceName,
3099 DestName= String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName), 3064 DestName= String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName),
3100 SourceFolder = sourceDirectory ?? sourceProperty, 3065 SourceFolder = sourceDirectory ?? sourceProperty,
3101 DestFolder = destinationDirectory ?? destinationProperty, 3066 DestFolder = destinationDirectory ?? destinationProperty,
3102 Delete = delete 3067 Delete = delete,
3103 }; 3068 });
3104
3105 this.Core.AddTuple(tuple);
3106 } 3069 }
3107 } 3070 }
3108 else // copy the file 3071 else // copy the file
@@ -3139,15 +3102,13 @@ namespace WixToolset.Core
3139 3102
3140 if (!this.Core.EncounteredError) 3103 if (!this.Core.EncounteredError)
3141 { 3104 {
3142 var tuple = new DuplicateFileTuple(sourceLineNumbers, id) 3105 this.Core.AddTuple(new DuplicateFileTuple(sourceLineNumbers, id)
3143 { 3106 {
3144 ComponentRef = componentId, 3107 ComponentRef = componentId,
3145 FileRef = fileId, 3108 FileRef = fileId,
3146 DestinationName = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName), 3109 DestinationName = String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName),
3147 DestinationFolder = destinationDirectory ?? destinationProperty 3110 DestinationFolder = destinationDirectory ?? destinationProperty,
3148 }; 3111 });
3149
3150 this.Core.AddTuple(tuple);
3151 } 3112 }
3152 } 3113 }
3153 } 3114 }
@@ -3194,7 +3155,7 @@ namespace WixToolset.Core
3194 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3155 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3195 //sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData; 3156 //sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData;
3196 sourceType = CustomActionSourceType.Binary; 3157 sourceType = CustomActionSourceType.Binary;
3197 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary 3158 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, source); // add a reference to the appropriate Binary
3198 break; 3159 break;
3199 case "Directory": 3160 case "Directory":
3200 if (null != source) 3161 if (null != source)
@@ -3229,7 +3190,7 @@ namespace WixToolset.Core
3229 // to add a reference. No need to look at the value. 3190 // to add a reference. No need to look at the value.
3230 if (Int32.TryParse(target, out var ignored)) 3191 if (Int32.TryParse(target, out var ignored))
3231 { 3192 {
3232 this.Core.CreateSimpleReference(sourceLineNumbers, "Error", target); 3193 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Error, target);
3233 } 3194 }
3234 break; 3195 break;
3235 case "ExeCommand": 3196 case "ExeCommand":
@@ -3285,7 +3246,7 @@ namespace WixToolset.Core
3285 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3246 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3286 //sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile; 3247 //sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile;
3287 sourceType = CustomActionSourceType.File; 3248 sourceType = CustomActionSourceType.File;
3288 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File 3249 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, source); // add a reference to the appropriate File
3289 break; 3250 break;
3290 case "HideTarget": 3251 case "HideTarget":
3291 hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 3252 hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -3533,7 +3494,7 @@ namespace WixToolset.Core
3533 3494
3534 if (!this.Core.EncounteredError) 3495 if (!this.Core.EncounteredError)
3535 { 3496 {
3536 var tuple = new CustomActionTuple(sourceLineNumbers, id) 3497 this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, id)
3537 { 3498 {
3538 ExecutionType = executionType, 3499 ExecutionType = executionType,
3539 Source = source, 3500 Source = source,
@@ -3547,9 +3508,7 @@ namespace WixToolset.Core
3547 TSAware = tsAware, 3508 TSAware = tsAware,
3548 Win64 = win64, 3509 Win64 = win64,
3549 Hidden = hidden, 3510 Hidden = hidden,
3550 }; 3511 });
3551
3552 this.Core.AddTuple(tuple);
3553 3512
3554 if (YesNoType.Yes == suppressModularization) 3513 if (YesNoType.Yes == suppressModularization)
3555 { 3514 {
@@ -3562,9 +3521,9 @@ namespace WixToolset.Core
3562 /// Parses a simple reference element. 3521 /// Parses a simple reference element.
3563 /// </summary> 3522 /// </summary>
3564 /// <param name="node">Element to parse.</param> 3523 /// <param name="node">Element to parse.</param>
3565 /// <param name="table">Table which contains the target of the simple reference.</param> 3524 /// <param name="tupleDefinition">Tuple which contains the target of the simple reference.</param>
3566 /// <returns>Id of the referenced element.</returns> 3525 /// <returns>Id of the referenced element.</returns>
3567 private string ParseSimpleRefElement(XElement node, string table) 3526 private string ParseSimpleRefElement(XElement node, IntermediateTupleDefinition tupleDefinition)
3568 { 3527 {
3569 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3528 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3570 string id = null; 3529 string id = null;
@@ -3577,7 +3536,7 @@ namespace WixToolset.Core
3577 { 3536 {
3578 case "Id": 3537 case "Id":
3579 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3538 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3580 this.Core.CreateSimpleReference(sourceLineNumbers, table, id); 3539 this.Core.CreateSimpleReference(sourceLineNumbers, tupleDefinition.Name, id);
3581 break; 3540 break;
3582 default: 3541 default:
3583 this.Core.UnexpectedAttribute(node, attrib); 3542 this.Core.UnexpectedAttribute(node, attrib);
@@ -3640,7 +3599,7 @@ namespace WixToolset.Core
3640 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 3599 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
3641 } 3600 }
3642 3601
3643 this.Core.CreateSimpleReference(sourceLineNumbers, "MsiPatchSequence", primaryKeys); 3602 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.MsiPatchSequence, primaryKeys);
3644 3603
3645 this.Core.ParseForExtensionElements(node); 3604 this.Core.ParseForExtensionElements(node);
3646 3605
@@ -3932,14 +3891,14 @@ namespace WixToolset.Core
3932 } 3891 }
3933 } 3892 }
3934 3893
3935 this.Core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId); 3894 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixCustomTable, tableId);
3936 3895
3937 if (!this.Core.EncounteredError) 3896 if (!this.Core.EncounteredError)
3938 { 3897 {
3939 this.Core.AddTuple(new WixCustomRowTuple(childSourceLineNumbers) 3898 this.Core.AddTuple(new WixCustomRowTuple(childSourceLineNumbers)
3940 { 3899 {
3941 Table = tableId, 3900 Table = tableId,
3942 FieldData = dataValue 3901 FieldData = dataValue,
3943 }); 3902 });
3944 } 3903 }
3945 break; 3904 break;
@@ -3963,7 +3922,7 @@ namespace WixToolset.Core
3963 3922
3964 if (!this.Core.EncounteredError) 3923 if (!this.Core.EncounteredError)
3965 { 3924 {
3966 var tuple = new WixCustomTableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, tableId)) 3925 this.Core.AddTuple(new WixCustomTableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, tableId))
3967 { 3926 {
3968 ColumnCount = columnCount, 3927 ColumnCount = columnCount,
3969 ColumnNames = columnNames, 3928 ColumnNames = columnNames,
@@ -3977,10 +3936,8 @@ namespace WixToolset.Core
3977 Sets = sets, 3936 Sets = sets,
3978 Descriptions = descriptions, 3937 Descriptions = descriptions,
3979 Modularizations = modularizations, 3938 Modularizations = modularizations,
3980 Unreal = bootstrapperApplicationData 3939 Unreal = bootstrapperApplicationData,
3981 }; 3940 });
3982
3983 this.Core.AddTuple(tuple);
3984 } 3941 }
3985 } 3942 }
3986 } 3943 }
@@ -4079,7 +4036,7 @@ namespace WixToolset.Core
4079 if (inlineSyntax[0].EndsWith(":")) 4036 if (inlineSyntax[0].EndsWith(":"))
4080 { 4037 {
4081 parentId = inlineSyntax[0].TrimEnd(':'); 4038 parentId = inlineSyntax[0].TrimEnd(':');
4082 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", parentId); 4039 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, parentId);
4083 4040
4084 pathStartsAt = 1; 4041 pathStartsAt = 1;
4085 } 4042 }
@@ -4224,7 +4181,7 @@ namespace WixToolset.Core
4224 4181
4225 if (!this.Core.EncounteredError) 4182 if (!this.Core.EncounteredError)
4226 { 4183 {
4227 var tuple = new DirectoryTuple(sourceLineNumbers, id) 4184 this.Core.AddTuple(new DirectoryTuple(sourceLineNumbers, id)
4228 { 4185 {
4229 ParentDirectoryRef = parentId, 4186 ParentDirectoryRef = parentId,
4230 Name = name, 4187 Name = name,
@@ -4232,9 +4189,7 @@ namespace WixToolset.Core
4232 SourceName = sourceName, 4189 SourceName = sourceName,
4233 SourceShortName = shortSourceName, 4190 SourceShortName = shortSourceName,
4234 ComponentGuidGenerationSeed = componentGuidGenerationSeed 4191 ComponentGuidGenerationSeed = componentGuidGenerationSeed
4235 }; 4192 });
4236
4237 this.Core.AddTuple(tuple);
4238 4193
4239 if (null != symbols) 4194 if (null != symbols)
4240 { 4195 {
@@ -4268,7 +4223,7 @@ namespace WixToolset.Core
4268 { 4223 {
4269 case "Id": 4224 case "Id":
4270 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4225 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4271 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); 4226 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
4272 break; 4227 break;
4273 case "DiskId": 4228 case "DiskId":
4274 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue); 4229 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
@@ -4415,7 +4370,7 @@ namespace WixToolset.Core
4415 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 4370 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4416 } 4371 }
4417 oneChild = true; 4372 oneChild = true;
4418 signature = this.ParseSimpleRefElement(child, "Signature"); 4373 signature = this.ParseSimpleRefElement(child, TupleDefinitions.Signature);
4419 break; 4374 break;
4420 default: 4375 default:
4421 this.Core.UnexpectedElement(node, child); 4376 this.Core.UnexpectedElement(node, child);
@@ -4460,19 +4415,17 @@ namespace WixToolset.Core
4460 signature = id.Id; 4415 signature = id.Id;
4461 } 4416 }
4462 4417
4463 var tuple = new DrLocatorTuple(sourceLineNumbers, new Identifier(access, rowId, parentSignature, path)) 4418 var tuple = this.Core.AddTuple(new DrLocatorTuple(sourceLineNumbers, new Identifier(access, rowId, parentSignature, path))
4464 { 4419 {
4465 SignatureRef = rowId, 4420 SignatureRef = rowId,
4466 Parent = parentSignature, 4421 Parent = parentSignature,
4467 Path = path, 4422 Path = path,
4468 }; 4423 });
4469 4424
4470 if (CompilerConstants.IntegerNotSet != depth) 4425 if (CompilerConstants.IntegerNotSet != depth)
4471 { 4426 {
4472 tuple.Depth = depth; 4427 tuple.Depth = depth;
4473 } 4428 }
4474
4475 this.Core.AddTuple(tuple);
4476 } 4429 }
4477 4430
4478 return signature; 4431 return signature;
@@ -4575,7 +4528,7 @@ namespace WixToolset.Core
4575 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 4528 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4576 } 4529 }
4577 oneChild = true; 4530 oneChild = true;
4578 signature = this.ParseSimpleRefElement(child, "Signature"); 4531 signature = this.ParseSimpleRefElement(child, TupleDefinitions.Signature);
4579 break; 4532 break;
4580 default: 4533 default:
4581 this.Core.UnexpectedElement(node, child); 4534 this.Core.UnexpectedElement(node, child);
@@ -4589,7 +4542,7 @@ namespace WixToolset.Core
4589 } 4542 }
4590 4543
4591 4544
4592 this.Core.CreateSimpleReference(sourceLineNumbers, "DrLocator", id.Id, parentSignature, path); 4545 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.DrLocator, id.Id, parentSignature, path);
4593 4546
4594 return signature; 4547 return signature;
4595 } 4548 }
@@ -4829,7 +4782,7 @@ namespace WixToolset.Core
4829 4782
4830 if (!this.Core.EncounteredError) 4783 if (!this.Core.EncounteredError)
4831 { 4784 {
4832 var tuple = new FeatureTuple(sourceLineNumbers, id) 4785 this.Core.AddTuple(new FeatureTuple(sourceLineNumbers, id)
4833 { 4786 {
4834 ParentFeatureRef = null, // this field is set in the linker 4787 ParentFeatureRef = null, // this field is set in the linker
4835 Title = title, 4788 Title = title,
@@ -4841,9 +4794,7 @@ namespace WixToolset.Core
4841 DisallowAdvertise = disallowAdvertise, 4794 DisallowAdvertise = disallowAdvertise,
4842 InstallDefault = installDefault, 4795 InstallDefault = installDefault,
4843 TypicalDefault = typicalDefault, 4796 TypicalDefault = typicalDefault,
4844 }; 4797 });
4845
4846 this.Core.AddTuple(tuple);
4847 4798
4848 if (ComplexReferenceParentType.Unknown != parentType) 4799 if (ComplexReferenceParentType.Unknown != parentType)
4849 { 4800 {
@@ -4873,7 +4824,7 @@ namespace WixToolset.Core
4873 { 4824 {
4874 case "Id": 4825 case "Id":
4875 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4826 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4876 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", id); 4827 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, id);
4877 break; 4828 break;
4878 case "IgnoreParent": 4829 case "IgnoreParent":
4879 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 4830 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -5053,7 +5004,7 @@ namespace WixToolset.Core
5053 { 5004 {
5054 case "Id": 5005 case "Id":
5055 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5006 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5056 this.Core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id); 5007 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixFeatureGroup, id);
5057 break; 5008 break;
5058 case "IgnoreParent": 5009 case "IgnoreParent":
5059 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5010 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -5222,7 +5173,7 @@ namespace WixToolset.Core
5222 5173
5223 if (!this.Core.EncounteredError) 5174 if (!this.Core.EncounteredError)
5224 { 5175 {
5225 var tuple = new EnvironmentTuple(sourceLineNumbers, id) 5176 this.Core.AddTuple(new EnvironmentTuple(sourceLineNumbers, id)
5226 { 5177 {
5227 Name = name, 5178 Name = name,
5228 Value = value, 5179 Value = value,
@@ -5232,14 +5183,7 @@ namespace WixToolset.Core
5232 Permanent = permanent, 5183 Permanent = permanent,
5233 System = system, 5184 System = system,
5234 ComponentRef = componentId 5185 ComponentRef = componentId
5235 }; 5186 });
5236
5237 this.Core.AddTuple(tuple);
5238
5239 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Environment, id);
5240 //row.Set(1, String.Concat(action, uninstall, system ? "*" : String.Empty, name));
5241 //row.Set(2, text);
5242 //row.Set(3, componentId);
5243 } 5187 }
5244 } 5188 }
5245 5189
@@ -5282,12 +5226,10 @@ namespace WixToolset.Core
5282 5226
5283 if (!this.Core.EncounteredError) 5227 if (!this.Core.EncounteredError)
5284 { 5228 {
5285 var tuple = new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id)) 5229 this.Core.AddTuple(new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
5286 { 5230 {
5287 Message = Common.GetInnerText(node) 5231 Message = Common.GetInnerText(node)
5288 }; 5232 });
5289
5290 this.Core.AddTuple(tuple);
5291 } 5233 }
5292 } 5234 }
5293 5235
@@ -5373,18 +5315,16 @@ namespace WixToolset.Core
5373 { 5315 {
5374 if (!this.Core.EncounteredError) 5316 if (!this.Core.EncounteredError)
5375 { 5317 {
5376 var tuple = new ExtensionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, extension, componentId)) 5318 this.Core.AddTuple(new ExtensionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, extension, componentId))
5377 { 5319 {
5378 Extension = extension, 5320 Extension = extension,
5379 ComponentRef = componentId, 5321 ComponentRef = componentId,
5380 ProgIdRef = progId, 5322 ProgIdRef = progId,
5381 MimeRef = mime, 5323 MimeRef = mime,
5382 FeatureRef = Guid.Empty.ToString("B") 5324 FeatureRef = Guid.Empty.ToString("B"),
5383 }; 5325 });
5384
5385 this.Core.AddTuple(tuple);
5386 5326
5387 this.Core.EnsureTable(sourceLineNumbers, "Verb"); 5327 this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Verb);
5388 } 5328 }
5389 } 5329 }
5390 else if (YesNoType.No == advertise) 5330 else if (YesNoType.No == advertise)
@@ -5481,11 +5421,11 @@ namespace WixToolset.Core
5481 break; 5421 break;
5482 case "AssemblyApplication": 5422 case "AssemblyApplication":
5483 assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 5423 assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5484 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication); 5424 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, assemblyApplication);
5485 break; 5425 break;
5486 case "AssemblyManifest": 5426 case "AssemblyManifest":
5487 assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 5427 assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5488 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest); 5428 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, assemblyManifest);
5489 break; 5429 break;
5490 case "BindPath": 5430 case "BindPath":
5491 bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 5431 bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
@@ -5499,7 +5439,7 @@ namespace WixToolset.Core
5499 break; 5439 break;
5500 case "CompanionFile": 5440 case "CompanionFile":
5501 companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 5441 companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5502 this.Core.CreateSimpleReference(sourceLineNumbers, "File", companionFile); 5442 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, companionFile);
5503 break; 5443 break;
5504 case "Compressed": 5444 case "Compressed":
5505 var compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 5445 var compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
@@ -5797,7 +5737,7 @@ namespace WixToolset.Core
5797 attributes |= compressed.HasValue && compressed == false ? FileTupleAttributes.Uncompressed : 0; 5737 attributes |= compressed.HasValue && compressed == false ? FileTupleAttributes.Uncompressed : 0;
5798 attributes |= generatedShortFileName ? FileTupleAttributes.GeneratedShortFileName : 0; 5738 attributes |= generatedShortFileName ? FileTupleAttributes.GeneratedShortFileName : 0;
5799 5739
5800 var tuple = new FileTuple(sourceLineNumbers, id) 5740 this.Core.AddTuple(new FileTuple(sourceLineNumbers, id)
5801 { 5741 {
5802 ComponentRef = componentId, 5742 ComponentRef = componentId,
5803 Name = name, 5743 Name = name,
@@ -5831,10 +5771,8 @@ namespace WixToolset.Core
5831 IgnoreOffsets = ignoreOffsets, 5771 IgnoreOffsets = ignoreOffsets,
5832 IgnoreLengths = ignoreLengths, 5772 IgnoreLengths = ignoreLengths,
5833 RetainOffsets = protectOffsets, 5773 RetainOffsets = protectOffsets,
5834 SymbolPaths = symbols 5774 SymbolPaths = symbols,
5835 }; 5775 });
5836
5837 this.Core.AddTuple(tuple);
5838 5776
5839 if (AssemblyType.NotAnAssembly != assemblyType) 5777 if (AssemblyType.NotAnAssembly != assemblyType)
5840 { 5778 {
@@ -5850,7 +5788,7 @@ namespace WixToolset.Core
5850 } 5788 }
5851 } 5789 }
5852 5790
5853 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); 5791 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Media, diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
5854 5792
5855 // If this component does not have a companion file this file is a possible keypath. 5793 // If this component does not have a companion file this file is a possible keypath.
5856 possibleKeyPath = null; 5794 possibleKeyPath = null;
@@ -5990,13 +5928,13 @@ namespace WixToolset.Core
5990 5928
5991 if (!this.Core.EncounteredError) 5929 if (!this.Core.EncounteredError)
5992 { 5930 {
5993 var tuple = new SignatureTuple(sourceLineNumbers, id) 5931 var tuple = this.Core.AddTuple(new SignatureTuple(sourceLineNumbers, id)
5994 { 5932 {
5995 FileName = name ?? shortName, 5933 FileName = name ?? shortName,
5996 MinVersion = minVersion, 5934 MinVersion = minVersion,
5997 MaxVersion = maxVersion, 5935 MaxVersion = maxVersion,
5998 Languages = languages 5936 Languages = languages
5999 }; 5937 });
6000 5938
6001 if (CompilerConstants.IntegerNotSet != minSize) 5939 if (CompilerConstants.IntegerNotSet != minSize)
6002 { 5940 {
@@ -6018,8 +5956,6 @@ namespace WixToolset.Core
6018 tuple.MaxDate = maxDate; 5956 tuple.MaxDate = maxDate;
6019 } 5957 }
6020 5958
6021 this.Core.AddTuple(tuple);
6022
6023 // Create a DrLocator row to associate the file with a directory 5959 // Create a DrLocator row to associate the file with a directory
6024 // when a different identifier is specified for the FileSearch. 5960 // when a different identifier is specified for the FileSearch.
6025 if (!isSameId) 5961 if (!isSameId)
@@ -6125,7 +6061,7 @@ namespace WixToolset.Core
6125 this.ParseBundleExtensionElement(child); 6061 this.ParseBundleExtensionElement(child);
6126 break; 6062 break;
6127 case "BundleExtensionRef": 6063 case "BundleExtensionRef":
6128 this.ParseSimpleRefElement(child, "WixBundleExtension"); 6064 this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleExtension);
6129 break; 6065 break;
6130 case "ComplianceCheck": 6066 case "ComplianceCheck":
6131 this.ParseComplianceCheckElement(child); 6067 this.ParseComplianceCheckElement(child);
@@ -6146,7 +6082,7 @@ namespace WixToolset.Core
6146 this.ParseCustomActionElement(child); 6082 this.ParseCustomActionElement(child);
6147 break; 6083 break;
6148 case "CustomActionRef": 6084 case "CustomActionRef":
6149 this.ParseSimpleRefElement(child, "CustomAction"); 6085 this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
6150 break; 6086 break;
6151 case "CustomTable": 6087 case "CustomTable":
6152 this.ParseCustomTableElement(child); 6088 this.ParseCustomTableElement(child);
@@ -6161,7 +6097,7 @@ namespace WixToolset.Core
6161 this.ParseEmbeddedChainerElement(child); 6097 this.ParseEmbeddedChainerElement(child);
6162 break; 6098 break;
6163 case "EmbeddedChainerRef": 6099 case "EmbeddedChainerRef":
6164 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 6100 this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
6165 break; 6101 break;
6166 case "EnsureTable": 6102 case "EnsureTable":
6167 this.ParseEnsureTableElement(child); 6103 this.ParseEnsureTableElement(child);
@@ -6210,7 +6146,7 @@ namespace WixToolset.Core
6210 this.ParsePropertyElement(child); 6146 this.ParsePropertyElement(child);
6211 break; 6147 break;
6212 case "PropertyRef": 6148 case "PropertyRef":
6213 this.ParseSimpleRefElement(child, "Property"); 6149 this.ParseSimpleRefElement(child, TupleDefinitions.Property);
6214 break; 6150 break;
6215 case "RelatedBundle": 6151 case "RelatedBundle":
6216 this.ParseRelatedBundleElement(child); 6152 this.ParseRelatedBundleElement(child);
@@ -6225,7 +6161,7 @@ namespace WixToolset.Core
6225 this.ParseSetVariableElement(child); 6161 this.ParseSetVariableElement(child);
6226 break; 6162 break;
6227 case "SetVariableRef": 6163 case "SetVariableRef":
6228 this.ParseSimpleRefElement(child, "WixSetVariable"); 6164 this.ParseSimpleRefElement(child, TupleDefinitions.WixSetVariable);
6229 break; 6165 break;
6230 case "SFPCatalog": 6166 case "SFPCatalog":
6231 string parentName = null; 6167 string parentName = null;
@@ -6235,7 +6171,7 @@ namespace WixToolset.Core
6235 this.ParseUIElement(child); 6171 this.ParseUIElement(child);
6236 break; 6172 break;
6237 case "UIRef": 6173 case "UIRef":
6238 this.ParseSimpleRefElement(child, "WixUI"); 6174 this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
6239 break; 6175 break;
6240 case "Upgrade": 6176 case "Upgrade":
6241 this.ParseUpgradeElement(child); 6177 this.ParseUpgradeElement(child);
@@ -6555,7 +6491,7 @@ namespace WixToolset.Core
6555 6491
6556 if (!this.Core.EncounteredError) 6492 if (!this.Core.EncounteredError)
6557 { 6493 {
6558 var tuple = new IniFileTuple(sourceLineNumbers, id) 6494 this.Core.AddTuple(new IniFileTuple(sourceLineNumbers, id)
6559 { 6495 {
6560 FileName = this.GetMsiFilenameValue(shortName, name), 6496 FileName = this.GetMsiFilenameValue(shortName, name),
6561 DirProperty = directory, 6497 DirProperty = directory,
@@ -6564,9 +6500,7 @@ namespace WixToolset.Core
6564 Value = value, 6500 Value = value,
6565 Action = action.Value, 6501 Action = action.Value,
6566 ComponentRef = componentId 6502 ComponentRef = componentId
6567 }; 6503 });
6568
6569 this.Core.AddTuple(tuple);
6570 } 6504 }
6571 } 6505 }
6572 6506
@@ -6724,7 +6658,7 @@ namespace WixToolset.Core
6724 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 6658 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
6725 } 6659 }
6726 oneChild = true; 6660 oneChild = true;
6727 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 6661 var newId = this.ParseSimpleRefElement(child, TupleDefinitions.Signature); // FileSearch signatures override parent signatures
6728 id = new Identifier(AccessModifier.Private, newId); 6662 id = new Identifier(AccessModifier.Private, newId);
6729 signature = null; 6663 signature = null;
6730 break; 6664 break;
@@ -6741,21 +6675,19 @@ namespace WixToolset.Core
6741 6675
6742 if (!this.Core.EncounteredError) 6676 if (!this.Core.EncounteredError)
6743 { 6677 {
6744 var tuple = new IniLocatorTuple(sourceLineNumbers, id) 6678 var tuple = this.Core.AddTuple(new IniLocatorTuple(sourceLineNumbers, id)
6745 { 6679 {
6746 SignatureRef = id.Id, 6680 SignatureRef = id.Id,
6747 FileName = this.GetMsiFilenameValue(shortName, name), 6681 FileName = this.GetMsiFilenameValue(shortName, name),
6748 Section = section, 6682 Section = section,
6749 Key = key, 6683 Key = key,
6750 Type = type 6684 Type = type
6751 }; 6685 });
6752 6686
6753 if (CompilerConstants.IntegerNotSet != field) 6687 if (CompilerConstants.IntegerNotSet != field)
6754 { 6688 {
6755 tuple.Field = field; 6689 tuple.Field = field;
6756 } 6690 }
6757
6758 this.Core.AddTuple(tuple);
6759 } 6691 }
6760 6692
6761 return signature; 6693 return signature;
@@ -6779,7 +6711,7 @@ namespace WixToolset.Core
6779 { 6711 {
6780 case "Shared": 6712 case "Shared":
6781 shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 6713 shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
6782 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", shared); 6714 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Component, shared);
6783 break; 6715 break;
6784 default: 6716 default:
6785 this.Core.UnexpectedAttribute(node, attrib); 6717 this.Core.UnexpectedAttribute(node, attrib);
@@ -6841,9 +6773,22 @@ namespace WixToolset.Core
6841 6773
6842 if (!this.Core.EncounteredError) 6774 if (!this.Core.EncounteredError)
6843 { 6775 {
6844 var tuple = this.Core.CreateTuple(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? TupleDefinitionType.MsiPatchCertificate : TupleDefinitionType.MsiPackageCertificate); 6776 if ("PatchCertificates" == node.Name.LocalName)
6845 tuple.Set(0, name); 6777 {
6846 tuple.Set(1, name); 6778 this.Core.AddTuple(new MsiPatchCertificateTuple(sourceLineNumbers)
6779 {
6780 PatchCertificate = name,
6781 DigitalCertificateRef = name,
6782 });
6783 }
6784 else
6785 {
6786 this.Core.AddTuple(new MsiPackageCertificateTuple(sourceLineNumbers)
6787 {
6788 PackageCertificate = name,
6789 DigitalCertificateRef = name,
6790 });
6791 }
6847 } 6792 }
6848 break; 6793 break;
6849 default: 6794 default:
@@ -7109,14 +7054,14 @@ namespace WixToolset.Core
7109 if (!this.Core.EncounteredError) 7054 if (!this.Core.EncounteredError)
7110 { 7055 {
7111 // create the row that performs the upgrade (or downgrade) 7056 // create the row that performs the upgrade (or downgrade)
7112 var tuple = new UpgradeTuple(sourceLineNumbers) 7057 var tuple = this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
7113 { 7058 {
7114 UpgradeCode = upgradeCode, 7059 UpgradeCode = upgradeCode,
7115 Remove = removeFeatures, 7060 Remove = removeFeatures,
7116 MigrateFeatures = migrateFeatures, 7061 MigrateFeatures = migrateFeatures,
7117 IgnoreRemoveFailures = ignoreRemoveFailure, 7062 IgnoreRemoveFailures = ignoreRemoveFailure,
7118 ActionProperty = Common.UpgradeDetectedProperty 7063 ActionProperty = Common.UpgradeDetectedProperty
7119 }; 7064 });
7120 7065
7121 if (allowDowngrades) 7066 if (allowDowngrades)
7122 { 7067 {
@@ -7131,24 +7076,20 @@ namespace WixToolset.Core
7131 tuple.VersionMaxInclusive = allowSameVersionUpgrades; 7076 tuple.VersionMaxInclusive = allowSameVersionUpgrades;
7132 } 7077 }
7133 7078
7134 this.Core.AddTuple(tuple);
7135
7136 // Add launch condition that blocks upgrades 7079 // Add launch condition that blocks upgrades
7137 if (blockUpgrades) 7080 if (blockUpgrades)
7138 { 7081 {
7139 var conditionTuple = new LaunchConditionTuple(sourceLineNumbers) 7082 this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers)
7140 { 7083 {
7141 Condition = Common.UpgradePreventedCondition, 7084 Condition = Common.UpgradePreventedCondition,
7142 Description = downgradeErrorMessage 7085 Description = downgradeErrorMessage
7143 }; 7086 });
7144
7145 this.Core.AddTuple(conditionTuple);
7146 } 7087 }
7147 7088
7148 // now create the Upgrade row and launch conditions to prevent downgrades (unless explicitly permitted) 7089 // now create the Upgrade row and launch conditions to prevent downgrades (unless explicitly permitted)
7149 if (!allowDowngrades) 7090 if (!allowDowngrades)
7150 { 7091 {
7151 var upgradeTuple = new UpgradeTuple(sourceLineNumbers) 7092 this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
7152 { 7093 {
7153 UpgradeCode = upgradeCode, 7094 UpgradeCode = upgradeCode,
7154 VersionMin = productVersion, 7095 VersionMin = productVersion,
@@ -7156,17 +7097,13 @@ namespace WixToolset.Core
7156 OnlyDetect = true, 7097 OnlyDetect = true,
7157 IgnoreRemoveFailures = ignoreRemoveFailure, 7098 IgnoreRemoveFailures = ignoreRemoveFailure,
7158 ActionProperty = Common.DowngradeDetectedProperty 7099 ActionProperty = Common.DowngradeDetectedProperty
7159 }; 7100 });
7160
7161 this.Core.AddTuple(upgradeTuple);
7162 7101
7163 var conditionTuple = new LaunchConditionTuple(sourceLineNumbers) 7102 this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers)
7164 { 7103 {
7165 Condition = Common.DowngradePreventedCondition, 7104 Condition = Common.DowngradePreventedCondition,
7166 Description = downgradeErrorMessage 7105 Description = downgradeErrorMessage
7167 }; 7106 });
7168
7169 this.Core.AddTuple(conditionTuple);
7170 } 7107 }
7171 7108
7172 // finally, schedule RemoveExistingProducts 7109 // finally, schedule RemoveExistingProducts
@@ -7232,7 +7169,7 @@ namespace WixToolset.Core
7232 break; 7169 break;
7233 case "DiskPrompt": 7170 case "DiskPrompt":
7234 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7171 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7235 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined 7172 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7236 break; 7173 break;
7237 case "EmbedCab": 7174 case "EmbedCab":
7238 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7175 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7364,7 +7301,7 @@ namespace WixToolset.Core
7364 // add the row to the section 7301 // add the row to the section
7365 if (!this.Core.EncounteredError) 7302 if (!this.Core.EncounteredError)
7366 { 7303 {
7367 var tuple = new MediaTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id)) 7304 this.Core.AddTuple(new MediaTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
7368 { 7305 {
7369 DiskId = id, 7306 DiskId = id,
7370 DiskPrompt = diskPrompt, 7307 DiskPrompt = diskPrompt,
@@ -7373,9 +7310,7 @@ namespace WixToolset.Core
7373 Source = source, // the Source column is only set when creating a patch 7310 Source = source, // the Source column is only set when creating a patch
7374 CompressionLevel = compressionLevel, 7311 CompressionLevel = compressionLevel,
7375 Layout = layout 7312 Layout = layout
7376 }; 7313 });
7377
7378 this.Core.AddTuple(tuple);
7379 7314
7380 if (null != symbols) 7315 if (null != symbols)
7381 { 7316 {
@@ -7441,7 +7376,7 @@ namespace WixToolset.Core
7441 break; 7376 break;
7442 case "DiskPrompt": 7377 case "DiskPrompt":
7443 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7378 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7444 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined 7379 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7445 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 7380 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
7446 break; 7381 break;
7447 case "EmbedCab": 7382 case "EmbedCab":
@@ -7480,7 +7415,7 @@ namespace WixToolset.Core
7480 DiskId = 1 7415 DiskId = 1
7481 }); 7416 });
7482 7417
7483 var tuple = new WixMediaTemplateTuple(sourceLineNumbers) 7418 this.Core.AddTuple(new WixMediaTemplateTuple(sourceLineNumbers)
7484 { 7419 {
7485 CabinetTemplate = cabinetTemplate, 7420 CabinetTemplate = cabinetTemplate,
7486 VolumeLabel = volumeLabel, 7421 VolumeLabel = volumeLabel,
@@ -7488,7 +7423,7 @@ namespace WixToolset.Core
7488 MaximumUncompressedMediaSize = maximumUncompressedMediaSize, 7423 MaximumUncompressedMediaSize = maximumUncompressedMediaSize,
7489 MaximumCabinetSizeForLargeFileSplitting = maximumCabinetSizeForLargeFileSplitting, 7424 MaximumCabinetSizeForLargeFileSplitting = maximumCabinetSizeForLargeFileSplitting,
7490 CompressionLevel = compressionLevel 7425 CompressionLevel = compressionLevel
7491 }; 7426 });
7492 7427
7493 //else 7428 //else
7494 //{ 7429 //{
@@ -7499,8 +7434,6 @@ namespace WixToolset.Core
7499 //{ 7434 //{
7500 // mediaTemplateRow.MaximumCabinetSizeForLargeFileSplitting = 0; // Default value of 0 corresponds to max size of 2048 MB (i.e. 2 GB) 7435 // mediaTemplateRow.MaximumCabinetSizeForLargeFileSplitting = 0; // Default value of 0 corresponds to max size of 2048 MB (i.e. 2 GB)
7501 //} 7436 //}
7502
7503 this.Core.AddTuple(tuple);
7504 } 7437 }
7505 } 7438 }
7506 7439
@@ -7530,7 +7463,7 @@ namespace WixToolset.Core
7530 break; 7463 break;
7531 case "DiskId": 7464 case "DiskId":
7532 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue); 7465 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
7533 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); 7466 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Media, diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
7534 break; 7467 break;
7535 case "FileCompression": 7468 case "FileCompression":
7536 var compress = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7469 var compress = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7604,7 +7537,7 @@ namespace WixToolset.Core
7604 7537
7605 if (!this.Core.EncounteredError) 7538 if (!this.Core.EncounteredError)
7606 { 7539 {
7607 var tuple = new WixMergeTuple(sourceLineNumbers, id) 7540 var tuple = this.Core.AddTuple(new WixMergeTuple(sourceLineNumbers, id)
7608 { 7541 {
7609 DirectoryRef = directoryId, 7542 DirectoryRef = directoryId,
7610 SourceFile = sourceFile, 7543 SourceFile = sourceFile,
@@ -7612,11 +7545,9 @@ namespace WixToolset.Core
7612 ConfigurationData = configData, 7545 ConfigurationData = configData,
7613 FileAttributes = attributes, 7546 FileAttributes = attributes,
7614 FeatureRef = Guid.Empty.ToString("B") 7547 FeatureRef = Guid.Empty.ToString("B")
7615 }; 7548 });
7616 7549
7617 tuple.Set((int)WixMergeTupleFields.Language, language); 7550 tuple.Set((int)WixMergeTupleFields.Language, language);
7618
7619 this.Core.AddTuple(tuple);
7620 } 7551 }
7621 } 7552 }
7622 7553
@@ -7701,7 +7632,7 @@ namespace WixToolset.Core
7701 { 7632 {
7702 case "Id": 7633 case "Id":
7703 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 7634 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
7704 this.Core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id); 7635 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixMerge, id);
7705 break; 7636 break;
7706 case "Primary": 7637 case "Primary":
7707 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7638 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
@@ -7794,14 +7725,12 @@ namespace WixToolset.Core
7794 7725
7795 if (!this.Core.EncounteredError) 7726 if (!this.Core.EncounteredError)
7796 { 7727 {
7797 var tuple = new MIMETuple(sourceLineNumbers, new Identifier(AccessModifier.Private, contentType)) 7728 this.Core.AddTuple(new MIMETuple(sourceLineNumbers, new Identifier(AccessModifier.Private, contentType))
7798 { 7729 {
7799 ContentType = contentType, 7730 ContentType = contentType,
7800 ExtensionRef = extension, 7731 ExtensionRef = extension,
7801 CLSID = classId 7732 CLSID = classId
7802 }; 7733 });
7803
7804 this.Core.AddTuple(tuple);
7805 } 7734 }
7806 } 7735 }
7807 else if (YesNoType.No == advertise) 7736 else if (YesNoType.No == advertise)
@@ -7902,12 +7831,10 @@ namespace WixToolset.Core
7902 { 7831 {
7903 if (!this.Core.EncounteredError) 7832 if (!this.Core.EncounteredError)
7904 { 7833 {
7905 var tuple = new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name)) 7834 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
7906 { 7835 {
7907 Value = value 7836 Value = value
7908 }; 7837 });
7909
7910 this.Core.AddTuple(tuple);
7911 } 7838 }
7912 } 7839 }
7913 7840
@@ -8063,13 +7990,11 @@ namespace WixToolset.Core
8063 7990
8064 if (!this.Core.EncounteredError) 7991 if (!this.Core.EncounteredError)
8065 { 7992 {
8066 var tuple = new WixPatchRefTuple(sourceLineNumbers) 7993 this.Core.AddTuple(new WixPatchRefTuple(sourceLineNumbers)
8067 { 7994 {
8068 Table = "*", 7995 Table = "*",
8069 PrimaryKeys = "*" 7996 PrimaryKeys = "*",
8070 }; 7997 });
8071
8072 this.Core.AddTuple(tuple);
8073 } 7998 }
8074 } 7999 }
8075 8000
@@ -8112,13 +8037,11 @@ namespace WixToolset.Core
8112 8037
8113 if (!this.Core.EncounteredError) 8038 if (!this.Core.EncounteredError)
8114 { 8039 {
8115 var tuple = new WixPatchRefTuple(sourceLineNumbers) 8040 this.Core.AddTuple(new WixPatchRefTuple(sourceLineNumbers)
8116 { 8041 {
8117 Table = tableName, 8042 Table = tableName,
8118 PrimaryKeys = id 8043 PrimaryKeys = id
8119 }; 8044 });
8120
8121 this.Core.AddTuple(tuple);
8122 } 8045 }
8123 } 8046 }
8124 8047
@@ -8232,16 +8155,14 @@ namespace WixToolset.Core
8232 8155
8233 if (!this.Core.EncounteredError) 8156 if (!this.Core.EncounteredError)
8234 { 8157 {
8235 var tuple = new WixPatchBaselineTuple(sourceLineNumbers, id) 8158 this.Core.AddTuple(new WixPatchBaselineTuple(sourceLineNumbers, id)
8236 { 8159 {
8237 DiskId = diskId ?? 1, 8160 DiskId = diskId ?? 1,
8238 ValidationFlags = validationFlags, 8161 ValidationFlags = validationFlags,
8239 BaselineFile = new IntermediateFieldPathValue { Path = baselineFile }, 8162 BaselineFile = new IntermediateFieldPathValue { Path = baselineFile },
8240 UpdateFile = new IntermediateFieldPathValue { Path = updateFile }, 8163 UpdateFile = new IntermediateFieldPathValue { Path = updateFile },
8241 TransformFile = new IntermediateFieldPathValue { Path = transformFile } 8164 TransformFile = new IntermediateFieldPathValue { Path = transformFile },
8242 }; 8165 });
8243
8244 this.Core.AddTuple(tuple);
8245 } 8166 }
8246 } 8167 }
8247 8168
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs
index 51828975..93f9276c 100644
--- a/src/WixToolset.Core/CompilerCore.cs
+++ b/src/WixToolset.Core/CompilerCore.cs
@@ -14,6 +14,7 @@ namespace WixToolset.Core
14 using System.Xml.Linq; 14 using System.Xml.Linq;
15 using WixToolset.Data; 15 using WixToolset.Data;
16 using WixToolset.Data.Tuples; 16 using WixToolset.Data.Tuples;
17 using WixToolset.Data.WindowsInstaller;
17 using WixToolset.Extensibility; 18 using WixToolset.Extensibility;
18 using WixToolset.Extensibility.Data; 19 using WixToolset.Extensibility.Data;
19 using WixToolset.Extensibility.Services; 20 using WixToolset.Extensibility.Services;
@@ -166,9 +167,10 @@ namespace WixToolset.Core
166 /// Add a tuple to the active section. 167 /// Add a tuple to the active section.
167 /// </summary> 168 /// </summary>
168 /// <param name="tuple">Tuple to add.</param> 169 /// <param name="tuple">Tuple to add.</param>
169 public void AddTuple(IntermediateTuple tuple) 170 public T AddTuple<T>(T tuple)
171 where T : IntermediateTuple
170 { 172 {
171 this.ActiveSection.Tuples.Add(tuple); 173 return this.ActiveSection.AddTuple(tuple);
172 } 174 }
173 175
174 /// <summary> 176 /// <summary>
@@ -351,23 +353,6 @@ namespace WixToolset.Core
351 } 353 }
352 354
353 /// <summary> 355 /// <summary>
354 /// Creates a tuple in the active section.
355 /// </summary>
356 /// <param name="sourceLineNumbers">Source and line number of current row.</param>
357 /// <param name="tupleType">Type of tuple to create.</param>
358 /// <param name="identifier">Optional identifier.</param>
359 /// <returns>New tuple.</returns>
360 public IntermediateTuple CreateTuple(SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null)
361 {
362 var tupleDefinition = TupleDefinitions.ByType(tupleType);
363 var tuple = tupleDefinition.CreateTuple(sourceLineNumbers, identifier);
364
365 this.ActiveSection.Tuples.Add(tuple);
366
367 return tuple;
368 }
369
370 /// <summary>
371 /// Creates directories using the inline directory syntax. 356 /// Creates directories using the inline directory syntax.
372 /// </summary> 357 /// </summary>
373 /// <param name="sourceLineNumbers">Source line information.</param> 358 /// <param name="sourceLineNumbers">Source line information.</param>
@@ -394,27 +379,38 @@ namespace WixToolset.Core
394 } 379 }
395 380
396 /// <summary> 381 /// <summary>
397 /// Create a WixSimpleReference row in the active section. 382 /// Create a WixSimpleReferenceTuple in the active section.
398 /// </summary> 383 /// </summary>
399 /// <param name="sourceLineNumbers">Source line information for the row.</param> 384 /// <param name="sourceLineNumbers">Source line information for the row.</param>
400 /// <param name="tableName">The table name of the simple reference.</param> 385 /// <param name="tupleName">The tuple name of the simple reference.</param>
401 /// <param name="primaryKeys">The primary keys of the simple reference.</param> 386 /// <param name="primaryKeys">The primary keys of the simple reference.</param>
402 public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys) 387 public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys)
403 { 388 {
404 if (!this.EncounteredError) 389 if (!this.EncounteredError)
405 { 390 {
406 string joinedKeys = String.Join("/", primaryKeys); 391 var joinedKeys = String.Join("/", primaryKeys);
407 string id = String.Concat(tableName, ":", joinedKeys); 392 var id = String.Concat(tupleName, ":", joinedKeys);
408 393
409 // If this simple reference hasn't been added to the active section already, add it. 394 // If this simple reference hasn't been added to the active section already, add it.
410 if (this.activeSectionSimpleReferences.Add(id)) 395 if (this.activeSectionSimpleReferences.Add(id))
411 { 396 {
412 this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tableName, primaryKeys); 397 this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tupleName, primaryKeys);
413 } 398 }
414 } 399 }
415 } 400 }
416 401
417 /// <summary> 402 /// <summary>
403 /// Create a WixSimpleReferenceTuple in the active section.
404 /// </summary>
405 /// <param name="sourceLineNumbers">Source line information for the row.</param>
406 /// <param name="tupleDefinition">The tuple definition of the simple reference.</param>
407 /// <param name="primaryKeys">The primary keys of the simple reference.</param>
408 public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys)
409 {
410 this.CreateSimpleReference(sourceLineNumbers, tupleDefinition.Name, primaryKeys);
411 }
412
413 /// <summary>
418 /// A row in the WixGroup table is added for this child node and its parent node. 414 /// A row in the WixGroup table is added for this child node and its parent node.
419 /// </summary> 415 /// </summary>
420 /// <param name="sourceLineNumbers">Source line information for the row.</param> 416 /// <param name="sourceLineNumbers">Source line information for the row.</param>
@@ -431,7 +427,7 @@ namespace WixToolset.Core
431 } 427 }
432 428
433 /// <summary> 429 /// <summary>
434 /// Add the appropriate rows to make sure that the given table shows up 430 /// Add the appropriate tuples to make sure that the given table shows up
435 /// in the resulting output. 431 /// in the resulting output.
436 /// </summary> 432 /// </summary>
437 /// <param name="sourceLineNumbers">Source line numbers.</param> 433 /// <param name="sourceLineNumbers">Source line numbers.</param>
@@ -445,6 +441,20 @@ namespace WixToolset.Core
445 } 441 }
446 442
447 /// <summary> 443 /// <summary>
444 /// Add the appropriate tuples to make sure that the given table shows up
445 /// in the resulting output.
446 /// </summary>
447 /// <param name="sourceLineNumbers">Source line numbers.</param>
448 /// <param name="tableDefinition">Definition of the table to ensure existance of.</param>
449 public void EnsureTable(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition)
450 {
451 if (!this.EncounteredError)
452 {
453 this.parseHelper.EnsureTable(this.ActiveSection, sourceLineNumbers, tableDefinition);
454 }
455 }
456
457 /// <summary>
448 /// Get an attribute value. 458 /// Get an attribute value.
449 /// </summary> 459 /// </summary>
450 /// <param name="sourceLineNumbers">Source line information about the owner element.</param> 460 /// <param name="sourceLineNumbers">Source line information about the owner element.</param>
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs
index 89d4b6da..d7cb36bc 100644
--- a/src/WixToolset.Core/Compiler_2.cs
+++ b/src/WixToolset.Core/Compiler_2.cs
@@ -193,7 +193,7 @@ namespace WixToolset.Core
193 this.ParseCustomActionElement(child); 193 this.ParseCustomActionElement(child);
194 break; 194 break;
195 case "CustomActionRef": 195 case "CustomActionRef":
196 this.ParseSimpleRefElement(child, "CustomAction"); 196 this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
197 break; 197 break;
198 case "CustomTable": 198 case "CustomTable":
199 this.ParseCustomTableElement(child); 199 this.ParseCustomTableElement(child);
@@ -208,7 +208,7 @@ namespace WixToolset.Core
208 this.ParseEmbeddedChainerElement(child); 208 this.ParseEmbeddedChainerElement(child);
209 break; 209 break;
210 case "EmbeddedChainerRef": 210 case "EmbeddedChainerRef":
211 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 211 this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
212 break; 212 break;
213 case "EnsureTable": 213 case "EnsureTable":
214 this.ParseEnsureTableElement(child); 214 this.ParseEnsureTableElement(child);
@@ -248,7 +248,7 @@ namespace WixToolset.Core
248 this.ParsePropertyElement(child); 248 this.ParsePropertyElement(child);
249 break; 249 break;
250 case "PropertyRef": 250 case "PropertyRef":
251 this.ParseSimpleRefElement(child, "Property"); 251 this.ParseSimpleRefElement(child, TupleDefinitions.Property);
252 break; 252 break;
253 case "SetDirectory": 253 case "SetDirectory":
254 this.ParseSetDirectoryElement(child); 254 this.ParseSetDirectoryElement(child);
@@ -274,7 +274,7 @@ namespace WixToolset.Core
274 this.ParseUIElement(child); 274 this.ParseUIElement(child);
275 break; 275 break;
276 case "UIRef": 276 case "UIRef":
277 this.ParseSimpleRefElement(child, "WixUI"); 277 this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
278 break; 278 break;
279 case "Upgrade": 279 case "Upgrade":
280 this.ParseUpgradeElement(child); 280 this.ParseUpgradeElement(child);
@@ -297,14 +297,12 @@ namespace WixToolset.Core
297 { 297 {
298 if (null != symbols) 298 if (null != symbols)
299 { 299 {
300 var tuple = new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers) 300 this.Core.AddTuple(new WixDeltaPatchSymbolPathsTuple(sourceLineNumbers)
301 { 301 {
302 SymbolId = productCode, 302 SymbolId = productCode,
303 SymbolType = SymbolPathType.Product, 303 SymbolType = SymbolPathType.Product,
304 SymbolPaths = symbols 304 SymbolPaths = symbols,
305 }; 305 });
306
307 this.Core.AddTuple(tuple);
308 } 306 }
309 } 307 }
310 } 308 }
@@ -340,14 +338,14 @@ namespace WixToolset.Core
340 break; 338 break;
341 case "File": 339 case "File":
342 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 340 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
343 this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver); 341 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, driver);
344 break; 342 break;
345 case "Name": 343 case "Name":
346 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 344 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
347 break; 345 break;
348 case "SetupFile": 346 case "SetupFile":
349 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 347 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
350 this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup); 348 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, setup);
351 break; 349 break;
352 default: 350 default:
353 this.Core.UnexpectedAttribute(node, attrib); 351 this.Core.UnexpectedAttribute(node, attrib);
@@ -405,11 +403,29 @@ namespace WixToolset.Core
405 403
406 if (!this.Core.EncounteredError) 404 if (!this.Core.EncounteredError)
407 { 405 {
408 var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, id); 406 switch (tupleDefinitionType)
409 tuple.Set(1, componentId); 407 {
410 tuple.Set(2, name); 408 case TupleDefinitionType.ODBCDriver:
411 tuple.Set(3, driver); 409 this.Core.AddTuple(new ODBCDriverTuple(sourceLineNumbers, id)
412 tuple.Set(4, setup); 410 {
411 ComponentRef = componentId,
412 Description = name,
413 FileRef = driver,
414 SetupFileRef = setup,
415 });
416 break;
417 case TupleDefinitionType.ODBCTranslator:
418 this.Core.AddTuple(new ODBCTranslatorTuple(sourceLineNumbers, id)
419 {
420 ComponentRef = componentId,
421 Description = name,
422 FileRef = driver,
423 SetupFileRef = setup,
424 });
425 break;
426 default:
427 throw new ArgumentOutOfRangeException(nameof(tupleDefinitionType));
428 }
413 } 429 }
414 } 430 }
415 431
@@ -457,10 +473,28 @@ namespace WixToolset.Core
457 473
458 if (!this.Core.EncounteredError) 474 if (!this.Core.EncounteredError)
459 { 475 {
460 var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleDefinitionType, new Identifier(AccessModifier.Private, parentId, id)); 476 var identifier = new Identifier(AccessModifier.Private, parentId, id);
461 tuple.Set(0, parentId); 477 switch (tupleDefinitionType)
462 tuple.Set(1, id); 478 {
463 tuple.Set(2, propertyValue); 479 case TupleDefinitionType.ODBCAttribute:
480 this.Core.AddTuple(new ODBCAttributeTuple(sourceLineNumbers, identifier)
481 {
482 DriverRef = parentId,
483 Attribute = id,
484 Value = propertyValue,
485 });
486 break;
487 case TupleDefinitionType.ODBCSourceAttribute:
488 this.Core.AddTuple(new ODBCSourceAttributeTuple(sourceLineNumbers, identifier)
489 {
490 DataSourceRef = parentId,
491 Attribute = id,
492 Value = propertyValue,
493 });
494 break;
495 default:
496 throw new ArgumentOutOfRangeException(nameof(tupleDefinitionType));
497 }
464 } 498 }
465 } 499 }
466 500
@@ -674,13 +708,11 @@ namespace WixToolset.Core
674 switch (installScope) 708 switch (installScope)
675 { 709 {
676 case "perMachine": 710 case "perMachine":
677 {
678 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS")) 711 this.Core.AddTuple(new PropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "ALLUSERS"))
679 { 712 {
680 Value = "1" 713 Value = "1"
681 }); 714 });
682 installScopeSeen = true; 715 installScopeSeen = true;
683 }
684 break; 716 break;
685 case "perUser": 717 case "perUser":
686 sourceBits |= 8; 718 sourceBits |= 8;
@@ -1353,18 +1385,18 @@ namespace WixToolset.Core
1353 { 1385 {
1354 if (!this.Core.EncounteredError) 1386 if (!this.Core.EncounteredError)
1355 { 1387 {
1356 var tuple = new ProgIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, progId)) 1388 var tuple = this.Core.AddTuple(new ProgIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, progId))
1357 { 1389 {
1358 ProgId = progId, 1390 ProgId = progId,
1359 ParentProgIdRef = parent, 1391 ParentProgIdRef = parent,
1360 ClassRef = classId, 1392 ClassRef = classId,
1361 Description = description, 1393 Description = description,
1362 }; 1394 });
1363 1395
1364 if (null != icon) 1396 if (null != icon)
1365 { 1397 {
1366 tuple.IconRef = icon; 1398 tuple.IconRef = icon;
1367 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 1399 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
1368 } 1400 }
1369 1401
1370 if (CompilerConstants.IntegerNotSet != iconIndex) 1402 if (CompilerConstants.IntegerNotSet != iconIndex)
@@ -1372,9 +1404,7 @@ namespace WixToolset.Core
1372 tuple.IconIndex = iconIndex; 1404 tuple.IconIndex = iconIndex;
1373 } 1405 }
1374 1406
1375 this.Core.AddTuple(tuple); 1407 this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Class);
1376
1377 this.Core.EnsureTable(sourceLineNumbers, "Class");
1378 } 1408 }
1379 } 1409 }
1380 else if (YesNoType.No == advertise) 1410 else if (YesNoType.No == advertise)
@@ -1403,7 +1433,7 @@ namespace WixToolset.Core
1403 1433
1404 if (null != icon) // ProgId's Default Icon 1434 if (null != icon) // ProgId's Default Icon
1405 { 1435 {
1406 this.Core.CreateSimpleReference(sourceLineNumbers, "File", icon); 1436 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, icon);
1407 1437
1408 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon); 1438 icon = String.Format(CultureInfo.InvariantCulture, "\"[#{0}]\"", icon);
1409 1439
@@ -1513,7 +1543,7 @@ namespace WixToolset.Core
1513 1543
1514 if ("ErrorDialog" == id.Id) 1544 if ("ErrorDialog" == id.Id)
1515 { 1545 {
1516 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value); 1546 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, value);
1517 } 1547 }
1518 1548
1519 foreach (var child in node.Elements()) 1549 foreach (var child in node.Elements())
@@ -1764,15 +1794,13 @@ namespace WixToolset.Core
1764 1794
1765 if (!this.Core.EncounteredError && null != name) 1795 if (!this.Core.EncounteredError && null != name)
1766 { 1796 {
1767 var tuple = new RegistryTuple(sourceLineNumbers, id) 1797 this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
1768 { 1798 {
1769 Root = root.Value, 1799 Root = root.Value,
1770 Key = key, 1800 Key = key,
1771 Name = name, 1801 Name = name,
1772 ComponentRef = componentId, 1802 ComponentRef = componentId,
1773 }; 1803 });
1774
1775 this.Core.AddTuple(tuple);
1776 } 1804 }
1777 1805
1778 return keyPath; 1806 return keyPath;
@@ -2011,7 +2039,7 @@ namespace WixToolset.Core
2011 2039
2012 if (!this.Core.EncounteredError) 2040 if (!this.Core.EncounteredError)
2013 { 2041 {
2014 var tuple = new RegistryTuple(sourceLineNumbers, id) 2042 this.Core.AddTuple(new RegistryTuple(sourceLineNumbers, id)
2015 { 2043 {
2016 Root = root.Value, 2044 Root = root.Value,
2017 Key = key, 2045 Key = key,
@@ -2020,15 +2048,7 @@ namespace WixToolset.Core
2020 ValueType = valueType, 2048 ValueType = valueType,
2021 ValueAction = actionType, 2049 ValueAction = actionType,
2022 ComponentRef = componentId, 2050 ComponentRef = componentId,
2023 }; 2051 });
2024
2025 this.Core.AddTuple(tuple);
2026 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Registry, id);
2027 //row.Set(1, (int)root);
2028 //row.Set(2, key);
2029 //row.Set(3, name);
2030 //row.Set(4, value);
2031 //row.Set(5, componentId);
2032 } 2052 }
2033 2053
2034 // If this was just a regular registry key (that could be the key path) 2054 // If this was just a regular registry key (that could be the key path)
@@ -2134,16 +2154,14 @@ namespace WixToolset.Core
2134 2154
2135 if (!this.Core.EncounteredError) 2155 if (!this.Core.EncounteredError)
2136 { 2156 {
2137 var tuple = new RemoveRegistryTuple(sourceLineNumbers, id) 2157 this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2138 { 2158 {
2139 Root = root.Value, 2159 Root = root.Value,
2140 Key = key, 2160 Key = key,
2141 Name = name, 2161 Name = name,
2142 Action = actionType.Value, 2162 Action = actionType.Value,
2143 ComponentRef = componentId 2163 ComponentRef = componentId,
2144 }; 2164 });
2145
2146 this.Core.AddTuple(tuple);
2147 } 2165 }
2148 } 2166 }
2149 2167
@@ -2212,15 +2230,13 @@ namespace WixToolset.Core
2212 2230
2213 if (!this.Core.EncounteredError) 2231 if (!this.Core.EncounteredError)
2214 { 2232 {
2215 var tuple = new RemoveRegistryTuple(sourceLineNumbers, id) 2233 this.Core.AddTuple(new RemoveRegistryTuple(sourceLineNumbers, id)
2216 { 2234 {
2217 Root = root.Value, 2235 Root = root.Value,
2218 Key = key, 2236 Key = key,
2219 Name = name, 2237 Name = name,
2220 ComponentRef = componentId 2238 ComponentRef = componentId
2221 }; 2239 });
2222
2223 this.Core.AddTuple(tuple);
2224 } 2240 }
2225 } 2241 }
2226 2242
@@ -2333,16 +2349,14 @@ namespace WixToolset.Core
2333 2349
2334 if (!this.Core.EncounteredError) 2350 if (!this.Core.EncounteredError)
2335 { 2351 {
2336 var tuple = new RemoveFileTuple(sourceLineNumbers, id) 2352 this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2337 { 2353 {
2338 ComponentRef = componentId, 2354 ComponentRef = componentId,
2339 FileName = this.GetMsiFilenameValue(shortName, name), 2355 FileName = this.GetMsiFilenameValue(shortName, name),
2340 DirProperty = directory ?? property ?? parentDirectory, 2356 DirProperty = directory ?? property ?? parentDirectory,
2341 OnInstall = onInstall, 2357 OnInstall = onInstall,
2342 OnUninstall = onUninstall 2358 OnUninstall = onUninstall,
2343 }; 2359 });
2344
2345 this.Core.AddTuple(tuple);
2346 } 2360 }
2347 } 2361 }
2348 2362
@@ -2423,15 +2437,13 @@ namespace WixToolset.Core
2423 2437
2424 if (!this.Core.EncounteredError) 2438 if (!this.Core.EncounteredError)
2425 { 2439 {
2426 var tuple = new RemoveFileTuple(sourceLineNumbers, id) 2440 this.Core.AddTuple(new RemoveFileTuple(sourceLineNumbers, id)
2427 { 2441 {
2428 ComponentRef = componentId, 2442 ComponentRef = componentId,
2429 DirProperty = directory ?? property ?? parentDirectory, 2443 DirProperty = directory ?? property ?? parentDirectory,
2430 OnInstall = onInstall, 2444 OnInstall = onInstall,
2431 OnUninstall = onUninstall 2445 OnUninstall = onUninstall
2432 }; 2446 });
2433
2434 this.Core.AddTuple(tuple);
2435 } 2447 }
2436 } 2448 }
2437 2449
@@ -2540,7 +2552,7 @@ namespace WixToolset.Core
2540 if (customAction) 2552 if (customAction)
2541 { 2553 {
2542 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2554 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2543 this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName); 2555 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.CustomAction, actionName);
2544 } 2556 }
2545 else 2557 else
2546 { 2558 {
@@ -2551,7 +2563,7 @@ namespace WixToolset.Core
2551 if (customAction || showDialog || specialAction || specialStandardAction) 2563 if (customAction || showDialog || specialAction || specialStandardAction)
2552 { 2564 {
2553 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2565 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2554 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable.ToString(), afterAction); 2566 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.WixAction, sequenceTable.ToString(), afterAction);
2555 } 2567 }
2556 else 2568 else
2557 { 2569 {
@@ -2562,7 +2574,7 @@ namespace WixToolset.Core
2562 if (customAction || showDialog || specialAction || specialStandardAction) 2574 if (customAction || showDialog || specialAction || specialStandardAction)
2563 { 2575 {
2564 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2576 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2565 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable.ToString(), beforeAction); 2577 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.WixAction, sequenceTable.ToString(), beforeAction);
2566 } 2578 }
2567 else 2579 else
2568 { 2580 {
@@ -2573,7 +2585,7 @@ namespace WixToolset.Core
2573 if (showDialog) 2585 if (showDialog)
2574 { 2586 {
2575 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 2587 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
2576 this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName); 2588 this.Core.CreateSimpleReference(childSourceLineNumbers, TupleDefinitions.Dialog, actionName);
2577 } 2589 }
2578 else 2590 else
2579 { 2591 {
@@ -2699,7 +2711,7 @@ namespace WixToolset.Core
2699 } 2711 }
2700 else 2712 else
2701 { 2713 {
2702 var tuple = new WixActionTuple(childSourceLineNumbers, new Identifier(AccessModifier.Public, sequenceTable, actionName)) 2714 var tuple = this.Core.AddTuple(new WixActionTuple(childSourceLineNumbers, new Identifier(AccessModifier.Public, sequenceTable, actionName))
2703 { 2715 {
2704 SequenceTable = sequenceTable, 2716 SequenceTable = sequenceTable,
2705 Action = actionName, 2717 Action = actionName,
@@ -2707,14 +2719,12 @@ namespace WixToolset.Core
2707 Before = beforeAction, 2719 Before = beforeAction,
2708 After = afterAction, 2720 After = afterAction,
2709 Overridable = overridable, 2721 Overridable = overridable,
2710 }; 2722 });
2711 2723
2712 if (CompilerConstants.IntegerNotSet != sequence) 2724 if (CompilerConstants.IntegerNotSet != sequence)
2713 { 2725 {
2714 tuple.Sequence = sequence; 2726 tuple.Sequence = sequence;
2715 } 2727 }
2716
2717 this.Core.AddTuple(tuple);
2718 } 2728 }
2719 } 2729 }
2720 } 2730 }
@@ -3008,7 +3018,7 @@ namespace WixToolset.Core
3008 { 3018 {
3009 if (!String.IsNullOrEmpty(delayedAutoStart)) 3019 if (!String.IsNullOrEmpty(delayedAutoStart))
3010 { 3020 {
3011 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".DS"))) 3021 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".DS")))
3012 { 3022 {
3013 Name = name, 3023 Name = name,
3014 OnInstall = install, 3024 OnInstall = install,
@@ -3017,20 +3027,12 @@ namespace WixToolset.Core
3017 ConfigType = MsiServiceConfigType.DelayedAutoStart, 3027 ConfigType = MsiServiceConfigType.DelayedAutoStart,
3018 Argument = delayedAutoStart, 3028 Argument = delayedAutoStart,
3019 ComponentRef = componentId, 3029 ComponentRef = componentId,
3020 }; 3030 });
3021
3022 this.Core.AddTuple(tuple);
3023 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".DS"), id.Access));
3024 //row.Set(1, name);
3025 //row.Set(2, events);
3026 //row.Set(3, 3);
3027 //row.Set(4, delayedAutoStart);
3028 //row.Set(5, componentId);
3029 } 3031 }
3030 3032
3031 if (!String.IsNullOrEmpty(failureActionsWhen)) 3033 if (!String.IsNullOrEmpty(failureActionsWhen))
3032 { 3034 {
3033 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".FA"))) 3035 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".FA")))
3034 { 3036 {
3035 Name = name, 3037 Name = name,
3036 OnInstall = install, 3038 OnInstall = install,
@@ -3039,20 +3041,12 @@ namespace WixToolset.Core
3039 ConfigType = MsiServiceConfigType.FailureActionsFlag, 3041 ConfigType = MsiServiceConfigType.FailureActionsFlag,
3040 Argument = failureActionsWhen, 3042 Argument = failureActionsWhen,
3041 ComponentRef = componentId, 3043 ComponentRef = componentId,
3042 }; 3044 });
3043
3044 this.Core.AddTuple(tuple);
3045 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".FA"), id.Access));
3046 //row.Set(1, name);
3047 //row.Set(2, events);
3048 //row.Set(3, 4);
3049 //row.Set(4, failureActionsWhen);
3050 //row.Set(5, componentId);
3051 } 3045 }
3052 3046
3053 if (!String.IsNullOrEmpty(sid)) 3047 if (!String.IsNullOrEmpty(sid))
3054 { 3048 {
3055 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".SS"))) 3049 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".SS")))
3056 { 3050 {
3057 Name = name, 3051 Name = name,
3058 OnInstall = install, 3052 OnInstall = install,
@@ -3061,20 +3055,12 @@ namespace WixToolset.Core
3061 ConfigType = MsiServiceConfigType.ServiceSidInfo, 3055 ConfigType = MsiServiceConfigType.ServiceSidInfo,
3062 Argument = sid, 3056 Argument = sid,
3063 ComponentRef = componentId, 3057 ComponentRef = componentId,
3064 }; 3058 });
3065
3066 this.Core.AddTuple(tuple);
3067 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".SS"), id.Access));
3068 //row.Set(1, name);
3069 //row.Set(2, events);
3070 //row.Set(3, 5);
3071 //row.Set(4, sid);
3072 //row.Set(5, componentId);
3073 } 3059 }
3074 3060
3075 if (!String.IsNullOrEmpty(requiredPrivileges)) 3061 if (!String.IsNullOrEmpty(requiredPrivileges))
3076 { 3062 {
3077 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".RP"))) 3063 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".RP")))
3078 { 3064 {
3079 Name = name, 3065 Name = name,
3080 OnInstall = install, 3066 OnInstall = install,
@@ -3083,20 +3069,12 @@ namespace WixToolset.Core
3083 ConfigType = MsiServiceConfigType.RequiredPrivilegesInfo, 3069 ConfigType = MsiServiceConfigType.RequiredPrivilegesInfo,
3084 Argument = requiredPrivileges, 3070 Argument = requiredPrivileges,
3085 ComponentRef = componentId, 3071 ComponentRef = componentId,
3086 }; 3072 });
3087
3088 this.Core.AddTuple(tuple);
3089 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".RP"), id.Access));
3090 //row.Set(1, name);
3091 //row.Set(2, events);
3092 //row.Set(3, 6);
3093 //row.Set(4, requiredPrivileges);
3094 //row.Set(5, componentId);
3095 } 3073 }
3096 3074
3097 if (!String.IsNullOrEmpty(preShutdownDelay)) 3075 if (!String.IsNullOrEmpty(preShutdownDelay))
3098 { 3076 {
3099 var tuple = new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".PD"))) 3077 this.Core.AddTuple(new MsiServiceConfigTuple(sourceLineNumbers, new Identifier(id.Access, String.Concat(id.Id, ".PD")))
3100 { 3078 {
3101 Name = name, 3079 Name = name,
3102 OnInstall = install, 3080 OnInstall = install,
@@ -3105,15 +3083,7 @@ namespace WixToolset.Core
3105 ConfigType = MsiServiceConfigType.PreshutdownInfo, 3083 ConfigType = MsiServiceConfigType.PreshutdownInfo,
3106 Argument = preShutdownDelay, 3084 Argument = preShutdownDelay,
3107 ComponentRef = componentId, 3085 ComponentRef = componentId,
3108 }; 3086 });
3109
3110 this.Core.AddTuple(tuple);
3111 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MsiServiceConfig, new Identifier(String.Concat(id.Id, ".PD"), id.Access));
3112 //row.Set(1, name);
3113 //row.Set(2, events);
3114 //row.Set(3, 7);
3115 //row.Set(4, preShutdownDelay);
3116 //row.Set(5, componentId);
3117 } 3087 }
3118 } 3088 }
3119 } 3089 }
@@ -3284,7 +3254,7 @@ namespace WixToolset.Core
3284 3254
3285 if (!this.Core.EncounteredError) 3255 if (!this.Core.EncounteredError)
3286 { 3256 {
3287 var tuple = new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id) 3257 this.Core.AddTuple(new MsiServiceConfigFailureActionsTuple(sourceLineNumbers, id)
3288 { 3258 {
3289 Name = name, 3259 Name = name,
3290 OnInstall = install, 3260 OnInstall = install,
@@ -3296,9 +3266,7 @@ namespace WixToolset.Core
3296 Actions = actions, 3266 Actions = actions,
3297 DelayActions = actionsDelays, 3267 DelayActions = actionsDelays,
3298 ComponentRef = componentId, 3268 ComponentRef = componentId,
3299 }; 3269 });
3300
3301 this.Core.AddTuple(tuple);
3302 } 3270 }
3303 } 3271 }
3304 3272
@@ -3438,7 +3406,7 @@ namespace WixToolset.Core
3438 3406
3439 if (!this.Core.EncounteredError) 3407 if (!this.Core.EncounteredError)
3440 { 3408 {
3441 var tuple = new ServiceControlTuple(sourceLineNumbers, id) 3409 this.Core.AddTuple(new ServiceControlTuple(sourceLineNumbers, id)
3442 { 3410 {
3443 Name = name, 3411 Name = name,
3444 InstallRemove = installRemove, 3412 InstallRemove = installRemove,
@@ -3450,9 +3418,7 @@ namespace WixToolset.Core
3450 Arguments = arguments, 3418 Arguments = arguments,
3451 Wait = wait, 3419 Wait = wait,
3452 ComponentRef = componentId 3420 ComponentRef = componentId
3453 }; 3421 });
3454
3455 this.Core.AddTuple(tuple);
3456 } 3422 }
3457 } 3423 }
3458 3424
@@ -3697,7 +3663,7 @@ namespace WixToolset.Core
3697 3663
3698 if (!this.Core.EncounteredError) 3664 if (!this.Core.EncounteredError)
3699 { 3665 {
3700 var tuple = new ServiceInstallTuple(sourceLineNumbers, id) 3666 this.Core.AddTuple(new ServiceInstallTuple(sourceLineNumbers, id)
3701 { 3667 {
3702 Name = name, 3668 Name = name,
3703 DisplayName = displayName, 3669 DisplayName = displayName,
@@ -3713,23 +3679,7 @@ namespace WixToolset.Core
3713 Description = description, 3679 Description = description,
3714 Interactive = interactive, 3680 Interactive = interactive,
3715 Vital = vital 3681 Vital = vital
3716 }; 3682 });
3717
3718 this.Core.AddTuple(tuple);
3719
3720 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ServiceInstall, id);
3721 //row.Set(1, name);
3722 //row.Set(2, displayName);
3723 //row.Set(3, typebits);
3724 //row.Set(4, startType);
3725 //row.Set(5, errorbits);
3726 //row.Set(6, loadOrderGroup);
3727 //row.Set(7, dependencies);
3728 //row.Set(8, account);
3729 //row.Set(9, password);
3730 //row.Set(10, arguments);
3731 //row.Set(11, componentId);
3732 //row.Set(12, description);
3733 } 3683 }
3734 } 3684 }
3735 3685
@@ -3758,7 +3708,7 @@ namespace WixToolset.Core
3758 break; 3708 break;
3759 case "Id": 3709 case "Id":
3760 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3710 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3761 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); 3711 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Directory, id);
3762 break; 3712 break;
3763 case "Sequence": 3713 case "Sequence":
3764 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3714 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -3816,16 +3766,14 @@ namespace WixToolset.Core
3816 3766
3817 if (!this.Core.EncounteredError) 3767 if (!this.Core.EncounteredError)
3818 { 3768 {
3819 var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName)) 3769 this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3820 { 3770 {
3821 ExecutionType = executionType, 3771 ExecutionType = executionType,
3822 SourceType = CustomActionSourceType.Directory, 3772 SourceType = CustomActionSourceType.Directory,
3823 TargetType = CustomActionTargetType.TextData, 3773 TargetType = CustomActionTargetType.TextData,
3824 Source = id, 3774 Source = id,
3825 Target = value 3775 Target = value
3826 }; 3776 });
3827
3828 this.Core.AddTuple(tuple);
3829 3777
3830 foreach (var sequence in sequences) 3778 foreach (var sequence in sequences)
3831 { 3779 {
@@ -3966,16 +3914,14 @@ namespace WixToolset.Core
3966 this.Core.Write(ErrorMessages.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction)); 3914 this.Core.Write(ErrorMessages.ActionScheduledRelativeToItself(sourceLineNumbers, node.Name.LocalName, "After", afterAction));
3967 } 3915 }
3968 3916
3969 var tuple = new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName)) 3917 this.Core.AddTuple(new CustomActionTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, actionName))
3970 { 3918 {
3971 ExecutionType = executionType, 3919 ExecutionType = executionType,
3972 SourceType = CustomActionSourceType.Property, 3920 SourceType = CustomActionSourceType.Property,
3973 TargetType = CustomActionTargetType.TextData, 3921 TargetType = CustomActionTargetType.TextData,
3974 Source = id, 3922 Source = id,
3975 Target = value 3923 Target = value,
3976 }; 3924 });
3977
3978 this.Core.AddTuple(tuple);
3979 3925
3980 foreach (var sequence in sequences) 3926 foreach (var sequence in sequences)
3981 { 3927 {
@@ -4192,7 +4138,7 @@ namespace WixToolset.Core
4192 break; 4138 break;
4193 case "Icon": 4139 case "Icon":
4194 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4140 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4195 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 4141 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Icon, icon);
4196 break; 4142 break;
4197 case "IconIndex": 4143 case "IconIndex":
4198 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue); 4144 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
@@ -4390,7 +4336,7 @@ namespace WixToolset.Core
4390 target = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget); 4336 target = String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget);
4391 } 4337 }
4392 4338
4393 var tuple = new ShortcutTuple(sourceLineNumbers, id) 4339 this.Core.AddTuple(new ShortcutTuple(sourceLineNumbers, id)
4394 { 4340 {
4395 DirectoryRef = directory, 4341 DirectoryRef = directory,
4396 Name = name, 4342 Name = name,
@@ -4408,9 +4354,7 @@ namespace WixToolset.Core
4408 DisplayResourceId = displayResourceId, 4354 DisplayResourceId = displayResourceId,
4409 DescriptionResourceDll = descriptionResourceDll, 4355 DescriptionResourceDll = descriptionResourceDll,
4410 DescriptionResourceId = descriptionResourceId, 4356 DescriptionResourceId = descriptionResourceId,
4411 }; 4357 });
4412
4413 this.Core.AddTuple(tuple);
4414 } 4358 }
4415 } 4359 }
4416 4360
@@ -4679,7 +4623,7 @@ namespace WixToolset.Core
4679 4623
4680 if (!this.Core.EncounteredError) 4624 if (!this.Core.EncounteredError)
4681 { 4625 {
4682 var tuple = new TypeLibTuple(sourceLineNumbers) 4626 var tuple = this.Core.AddTuple(new TypeLibTuple(sourceLineNumbers)
4683 { 4627 {
4684 LibId = id, 4628 LibId = id,
4685 Language = language, 4629 Language = language,
@@ -4687,7 +4631,7 @@ namespace WixToolset.Core
4687 Description = description, 4631 Description = description,
4688 DirectoryRef = helpDirectory, 4632 DirectoryRef = helpDirectory,
4689 FeatureRef = Guid.Empty.ToString("B") 4633 FeatureRef = Guid.Empty.ToString("B")
4690 }; 4634 });
4691 4635
4692 if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion) 4636 if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion)
4693 { 4637 {
@@ -4698,8 +4642,6 @@ namespace WixToolset.Core
4698 { 4642 {
4699 tuple.Cost = cost; 4643 tuple.Cost = cost;
4700 } 4644 }
4701
4702 this.Core.AddTuple(tuple);
4703 } 4645 }
4704 } 4646 }
4705 else if (YesNoType.No == advertise) 4647 else if (YesNoType.No == advertise)
@@ -4894,7 +4836,7 @@ namespace WixToolset.Core
4894 4836
4895 if (!this.Core.EncounteredError) 4837 if (!this.Core.EncounteredError)
4896 { 4838 {
4897 var tuple = new UpgradeTuple(sourceLineNumbers) 4839 this.Core.AddTuple(new UpgradeTuple(sourceLineNumbers)
4898 { 4840 {
4899 UpgradeCode = upgradeId, 4841 UpgradeCode = upgradeId,
4900 VersionMin = minimum, 4842 VersionMin = minimum,
@@ -4908,15 +4850,13 @@ namespace WixToolset.Core
4908 OnlyDetect = onlyDetect, 4850 OnlyDetect = onlyDetect,
4909 Remove = removeFeatures, 4851 Remove = removeFeatures,
4910 ActionProperty = actionProperty 4852 ActionProperty = actionProperty
4911 }; 4853 });
4912
4913 this.Core.AddTuple(tuple);
4914 4854
4915 // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence 4855 // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence
4916 // if at least one row in Upgrade table lacks the OnlyDetect attribute. 4856 // if at least one row in Upgrade table lacks the OnlyDetect attribute.
4917 if (!onlyDetect) 4857 if (!onlyDetect)
4918 { 4858 {
4919 this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", "RemoveExistingProducts"); 4859 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixAction, "InstallExecuteSequence", "RemoveExistingProducts");
4920 } 4860 }
4921 } 4861 }
4922 } 4862 }
@@ -4964,7 +4904,7 @@ namespace WixToolset.Core
4964 break; 4904 break;
4965 case "TargetFile": 4905 case "TargetFile":
4966 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4906 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4967 this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile); 4907 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, targetFile);
4968 break; 4908 break;
4969 case "TargetProperty": 4909 case "TargetProperty":
4970 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4910 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -5021,20 +4961,18 @@ namespace WixToolset.Core
5021 4961
5022 if (!this.Core.EncounteredError) 4962 if (!this.Core.EncounteredError)
5023 { 4963 {
5024 var tuple = new VerbTuple(sourceLineNumbers) 4964 var tuple = this.Core.AddTuple(new VerbTuple(sourceLineNumbers)
5025 { 4965 {
5026 ExtensionRef = extension, 4966 ExtensionRef = extension,
5027 Verb = id, 4967 Verb = id,
5028 Command = command, 4968 Command = command,
5029 Argument = argument, 4969 Argument = argument,
5030 }; 4970 });
5031 4971
5032 if (CompilerConstants.IntegerNotSet != sequence) 4972 if (CompilerConstants.IntegerNotSet != sequence)
5033 { 4973 {
5034 tuple.Sequence = sequence; 4974 tuple.Sequence = sequence;
5035 } 4975 }
5036
5037 this.Core.AddTuple(tuple);
5038 } 4976 }
5039 } 4977 }
5040 else if (YesNoType.No == advertise) 4978 else if (YesNoType.No == advertise)
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs
index ff746f8d..a0fe1608 100644
--- a/src/WixToolset.Core/Compiler_Bundle.cs
+++ b/src/WixToolset.Core/Compiler_Bundle.cs
@@ -84,14 +84,12 @@ namespace WixToolset.Core
84 84
85 if (!this.Core.EncounteredError) 85 if (!this.Core.EncounteredError)
86 { 86 {
87 var tuple = new WixApprovedExeForElevationTuple(sourceLineNumbers, id) 87 this.Core.AddTuple(new WixApprovedExeForElevationTuple(sourceLineNumbers, id)
88 { 88 {
89 Key = key, 89 Key = key,
90 ValueName = valueName, 90 ValueName = valueName,
91 Attributes = attributes 91 Attributes = attributes,
92 }; 92 });
93
94 this.Core.AddTuple(tuple);
95 } 93 }
96 } 94 }
97 95
@@ -282,7 +280,7 @@ namespace WixToolset.Core
282 this.ParseBundleExtensionElement(child); 280 this.ParseBundleExtensionElement(child);
283 break; 281 break;
284 case "BundleExtensionRef": 282 case "BundleExtensionRef":
285 this.ParseSimpleRefElement(child, "WixBundleExtension"); 283 this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleExtension);
286 break; 284 break;
287 case "OptionalUpdateRegistration": 285 case "OptionalUpdateRegistration":
288 this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name); 286 this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name);
@@ -303,7 +301,7 @@ namespace WixToolset.Core
303 this.ParseContainerElement(child); 301 this.ParseContainerElement(child);
304 break; 302 break;
305 case "ContainerRef": 303 case "ContainerRef":
306 this.ParseSimpleRefElement(child, "WixBundleContainer"); 304 this.ParseSimpleRefElement(child, TupleDefinitions.WixBundleContainer);
307 break; 305 break;
308 case "Log": 306 case "Log":
309 if (logSeen) 307 if (logSeen)
@@ -327,7 +325,7 @@ namespace WixToolset.Core
327 this.ParseSetVariableElement(child); 325 this.ParseSetVariableElement(child);
328 break; 326 break;
329 case "SetVariableRef": 327 case "SetVariableRef":
330 this.ParseSimpleRefElement(child, "WixSetVariable"); 328 this.ParseSimpleRefElement(child, TupleDefinitions.WixSetVariable);
331 break; 329 break;
332 case "Update": 330 case "Update":
333 this.ParseUpdateElement(child); 331 this.ParseUpdateElement(child);
@@ -356,7 +354,7 @@ namespace WixToolset.Core
356 354
357 if (!this.Core.EncounteredError) 355 if (!this.Core.EncounteredError)
358 { 356 {
359 var tuple = new WixBundleTuple(sourceLineNumbers) 357 var tuple = this.Core.AddTuple(new WixBundleTuple(sourceLineNumbers)
360 { 358 {
361 UpgradeCode = upgradeCode, 359 UpgradeCode = upgradeCode,
362 Version = version, 360 Version = version,
@@ -375,7 +373,7 @@ namespace WixToolset.Core
375 Tag = tag, 373 Tag = tag,
376 Platform = this.CurrentPlatform, 374 Platform = this.CurrentPlatform,
377 ParentName = parentName, 375 ParentName = parentName,
378 }; 376 });
379 377
380 if (!String.IsNullOrEmpty(logVariablePrefixAndExtension)) 378 if (!String.IsNullOrEmpty(logVariablePrefixAndExtension))
381 { 379 {
@@ -385,8 +383,6 @@ namespace WixToolset.Core
385 tuple.LogExtension = split[2]; 383 tuple.LogExtension = split[2];
386 } 384 }
387 385
388 this.Core.AddTuple(tuple);;
389
390 if (null != upgradeCode) 386 if (null != upgradeCode)
391 { 387 {
392 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers) 388 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers)
@@ -399,32 +395,32 @@ namespace WixToolset.Core
399 this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, Compiler.BurnDefaultAttachedContainerId) 395 this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, Compiler.BurnDefaultAttachedContainerId)
400 { 396 {
401 Name = "bundle-attached.cab", 397 Name = "bundle-attached.cab",
402 Type = ContainerType.Attached 398 Type = ContainerType.Attached,
403 }); 399 });
404 400
405 // Ensure that the bundle stores the well-known persisted values. 401 // Ensure that the bundle stores the well-known persisted values.
406 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_NAME)) 402 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_NAME))
407 { 403 {
408 Hidden = false, 404 Hidden = false,
409 Persisted = true 405 Persisted = true,
410 }); 406 });
411 407
412 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE)) 408 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE))
413 { 409 {
414 Hidden = false, 410 Hidden = false,
415 Persisted = true 411 Persisted = true,
416 }); 412 });
417 413
418 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER)) 414 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER))
419 { 415 {
420 Hidden = false, 416 Hidden = false,
421 Persisted = true 417 Persisted = true,
422 }); 418 });
423 419
424 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE)) 420 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE))
425 { 421 {
426 Hidden = false, 422 Hidden = false,
427 Persisted = true 423 Persisted = true,
428 }); 424 });
429 } 425 }
430 } 426 }
@@ -767,7 +763,7 @@ namespace WixToolset.Core
767 } 763 }
768 else 764 else
769 { 765 {
770 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBootstrapperApplication", id); 766 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBootstrapperApplication, id);
771 } 767 }
772 } 768 }
773 769
@@ -830,11 +826,10 @@ namespace WixToolset.Core
830 // Add the BundleExtension. 826 // Add the BundleExtension.
831 if (!this.Core.EncounteredError) 827 if (!this.Core.EncounteredError)
832 { 828 {
833 var tuple = new WixBundleExtensionTuple(sourceLineNumbers, id) 829 this.Core.AddTuple(new WixBundleExtensionTuple(sourceLineNumbers, id)
834 { 830 {
835 PayloadRef = id.Id, 831 PayloadRef = id.Id,
836 }; 832 });
837 this.Core.AddTuple(tuple);
838 } 833 }
839 } 834 }
840 835
@@ -1194,7 +1189,7 @@ namespace WixToolset.Core
1194 1189
1195 if (!this.Core.EncounteredError) 1190 if (!this.Core.EncounteredError)
1196 { 1191 {
1197 tuple = new WixBundlePayloadTuple(sourceLineNumbers, id) 1192 tuple = this.Core.AddTuple(new WixBundlePayloadTuple(sourceLineNumbers, id)
1198 { 1193 {
1199 Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name, 1194 Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name,
1200 SourceFile = new IntermediateFieldPathValue { Path = sourceFile }, 1195 SourceFile = new IntermediateFieldPathValue { Path = sourceFile },
@@ -1204,7 +1199,7 @@ namespace WixToolset.Core
1204 DisplayName = displayName, 1199 DisplayName = displayName,
1205 Description = description, 1200 Description = description,
1206 EnableSignatureValidation = (YesNoType.Yes == enableSignatureVerification) 1201 EnableSignatureValidation = (YesNoType.Yes == enableSignatureVerification)
1207 }; 1202 });
1208 1203
1209 if (null != remotePayload) 1204 if (null != remotePayload)
1210 { 1205 {
@@ -1217,8 +1212,6 @@ namespace WixToolset.Core
1217 tuple.Version = remotePayload.Version; 1212 tuple.Version = remotePayload.Version;
1218 } 1213 }
1219 1214
1220 this.Core.AddTuple(tuple);
1221
1222 this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId.Id, ComplexReferenceChildType.Payload, id.Id, previousType, previousId?.Id); 1215 this.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId.Id, ComplexReferenceChildType.Payload, id.Id, previousType, previousId?.Id);
1223 } 1216 }
1224 1217
@@ -1322,7 +1315,7 @@ namespace WixToolset.Core
1322 { 1315 {
1323 case "Id": 1316 case "Id":
1324 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 1317 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
1325 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id.Id); 1318 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePayloadGroup, id.Id);
1326 break; 1319 break;
1327 default: 1320 default:
1328 this.Core.UnexpectedAttribute(node, attrib); 1321 this.Core.UnexpectedAttribute(node, attrib);
@@ -1377,15 +1370,13 @@ namespace WixToolset.Core
1377 // TODO: Should we define our own enum for this, just to ensure there's no "cross-contamination"? 1370 // TODO: Should we define our own enum for this, just to ensure there's no "cross-contamination"?
1378 // TODO: Also, we could potentially include an 'Attributes' field to track things like 1371 // TODO: Also, we could potentially include an 'Attributes' field to track things like
1379 // 'before' vs. 'after', and explicit vs. inferred dependencies. 1372 // 'before' vs. 'after', and explicit vs. inferred dependencies.
1380 var tuple = new WixOrderingTuple(sourceLineNumbers) 1373 this.Core.AddTuple(new WixOrderingTuple(sourceLineNumbers)
1381 { 1374 {
1382 ItemType = type, 1375 ItemType = type,
1383 ItemIdRef = id, 1376 ItemIdRef = id,
1384 DependsOnType = previousType, 1377 DependsOnType = previousType,
1385 DependsOnIdRef = previousId 1378 DependsOnIdRef = previousId
1386 }; 1379 });
1387
1388 this.Core.AddTuple(tuple);
1389 } 1380 }
1390 } 1381 }
1391 1382
@@ -2101,7 +2092,7 @@ namespace WixToolset.Core
2101 attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0; 2092 attributes |= (YesNoType.Yes == permanent) ? WixBundlePackageAttributes.Permanent : 0;
2102 attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0; 2093 attributes |= (YesNoType.Yes == visible) ? WixBundlePackageAttributes.Visible : 0;
2103 2094
2104 var chainPackageTuple = new WixBundlePackageTuple(sourceLineNumbers, id) 2095 var chainPackageTuple = this.Core.AddTuple(new WixBundlePackageTuple(sourceLineNumbers, id)
2105 { 2096 {
2106 Type = packageType, 2097 Type = packageType,
2107 PayloadRef = id.Id, 2098 PayloadRef = id.Id,
@@ -2110,7 +2101,7 @@ namespace WixToolset.Core
2110 CacheId = cacheId, 2101 CacheId = cacheId,
2111 LogPathVariable = logPathVariable, 2102 LogPathVariable = logPathVariable,
2112 RollbackLogPathVariable = rollbackPathVariable, 2103 RollbackLogPathVariable = rollbackPathVariable,
2113 }; 2104 });
2114 2105
2115 if (YesNoAlwaysType.NotSet != cache) 2106 if (YesNoAlwaysType.NotSet != cache)
2116 { 2107 {
@@ -2132,8 +2123,6 @@ namespace WixToolset.Core
2132 chainPackageTuple.InstallSize = installSize; 2123 chainPackageTuple.InstallSize = installSize;
2133 } 2124 }
2134 2125
2135 this.Core.AddTuple(chainPackageTuple);
2136
2137 switch (packageType) 2126 switch (packageType)
2138 { 2127 {
2139 case WixBundlePackageType.Exe: 2128 case WixBundlePackageType.Exe:
@@ -2370,7 +2359,7 @@ namespace WixToolset.Core
2370 { 2359 {
2371 case "Id": 2360 case "Id":
2372 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2361 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2373 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id); 2362 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePackageGroup, id);
2374 break; 2363 break;
2375 case "After": 2364 case "After":
2376 after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2365 after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
@@ -2425,7 +2414,7 @@ namespace WixToolset.Core
2425 { 2414 {
2426 this.Core.AddTuple(new WixChainItemTuple(sourceLineNumbers, id)); 2415 this.Core.AddTuple(new WixChainItemTuple(sourceLineNumbers, id));
2427 2416
2428 var rollbackBoundary = new WixBundleRollbackBoundaryTuple(sourceLineNumbers, id); 2417 var rollbackBoundary = this.Core.AddTuple(new WixBundleRollbackBoundaryTuple(sourceLineNumbers, id));
2429 2418
2430 if (YesNoType.NotSet != vital) 2419 if (YesNoType.NotSet != vital)
2431 { 2420 {
@@ -2437,8 +2426,6 @@ namespace WixToolset.Core
2437 rollbackBoundary.Transaction = (transaction == YesNoType.Yes); 2426 rollbackBoundary.Transaction = (transaction == YesNoType.Yes);
2438 } 2427 }
2439 2428
2440 this.Core.AddTuple(rollbackBoundary);
2441
2442 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null); 2429 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, null);
2443 } 2430 }
2444 2431
@@ -2520,19 +2507,17 @@ namespace WixToolset.Core
2520 2507
2521 if (!this.Core.EncounteredError) 2508 if (!this.Core.EncounteredError)
2522 { 2509 {
2523 var tuple = new WixBundleMsiPropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, name)) 2510 var tuple = this.Core.AddTuple(new WixBundleMsiPropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, name))
2524 { 2511 {
2525 PackageRef = packageId, 2512 PackageRef = packageId,
2526 Name = name, 2513 Name = name,
2527 Value = value 2514 Value = value
2528 }; 2515 });
2529 2516
2530 if (!String.IsNullOrEmpty(condition)) 2517 if (!String.IsNullOrEmpty(condition))
2531 { 2518 {
2532 tuple.Condition = condition; 2519 tuple.Condition = condition;
2533 } 2520 }
2534
2535 this.Core.AddTuple(tuple);
2536 } 2521 }
2537 } 2522 }
2538 2523
@@ -2554,7 +2539,7 @@ namespace WixToolset.Core
2554 { 2539 {
2555 case "Id": 2540 case "Id":
2556 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2541 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2557 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id); 2542 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixBundlePackage, id);
2558 break; 2543 break;
2559 default: 2544 default:
2560 this.Core.UnexpectedAttribute(node, attrib); 2545 this.Core.UnexpectedAttribute(node, attrib);
@@ -2650,16 +2635,11 @@ namespace WixToolset.Core
2650 2635
2651 if (!this.Core.EncounteredError) 2636 if (!this.Core.EncounteredError)
2652 { 2637 {
2653 var tuple = new WixRelatedBundleTuple(sourceLineNumbers) 2638 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers)
2654 { 2639 {
2655 BundleId = id, 2640 BundleId = id,
2656 Action = actionType, 2641 Action = actionType,
2657 }; 2642 });
2658
2659 this.Core.AddTuple(tuple);
2660 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixRelatedBundle);
2661 //row.Set(0, id);
2662 //row.Set(1, (int)actionType);
2663 } 2643 }
2664 } 2644 }
2665 2645
@@ -2701,12 +2681,10 @@ namespace WixToolset.Core
2701 2681
2702 if (!this.Core.EncounteredError) 2682 if (!this.Core.EncounteredError)
2703 { 2683 {
2704 var tuple = new WixBundleUpdateTuple(sourceLineNumbers) 2684 this.Core.AddTuple(new WixBundleUpdateTuple(sourceLineNumbers)
2705 { 2685 {
2706 Location = location 2686 Location = location
2707 }; 2687 });
2708
2709 this.Core.AddTuple(tuple);
2710 } 2688 }
2711 } 2689 }
2712 2690
@@ -2773,12 +2751,11 @@ namespace WixToolset.Core
2773 2751
2774 if (!this.Messaging.EncounteredError) 2752 if (!this.Messaging.EncounteredError)
2775 { 2753 {
2776 var tuple = new WixSetVariableTuple(sourceLineNumbers, id) 2754 this.Core.AddTuple(new WixSetVariableTuple(sourceLineNumbers, id)
2777 { 2755 {
2778 Value = value, 2756 Value = value,
2779 Type = type, 2757 Type = type,
2780 }; 2758 });
2781 this.Core.AddTuple(tuple);
2782 } 2759 }
2783 } 2760 }
2784 2761
@@ -2848,15 +2825,13 @@ namespace WixToolset.Core
2848 2825
2849 if (!this.Core.EncounteredError) 2826 if (!this.Core.EncounteredError)
2850 { 2827 {
2851 var tuple = new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name)) 2828 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, name))
2852 { 2829 {
2853 Value = value, 2830 Value = value,
2854 Type = type, 2831 Type = type,
2855 Hidden = hidden, 2832 Hidden = hidden,
2856 Persisted = persisted 2833 Persisted = persisted
2857 }; 2834 });
2858
2859 this.Core.AddTuple(tuple);
2860 } 2835 }
2861 } 2836 }
2862 2837
diff --git a/src/WixToolset.Core/Compiler_EmbeddedUI.cs b/src/WixToolset.Core/Compiler_EmbeddedUI.cs
index e71c2f56..706fe6e9 100644
--- a/src/WixToolset.Core/Compiler_EmbeddedUI.cs
+++ b/src/WixToolset.Core/Compiler_EmbeddedUI.cs
@@ -42,7 +42,7 @@ namespace WixToolset.Core
42 } 42 }
43 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 43 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
44 type = 0x2; 44 type = 0x2;
45 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary 45 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, source); // add a reference to the appropriate Binary
46 break; 46 break;
47 case "CommandLine": 47 case "CommandLine":
48 commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 48 commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -54,7 +54,7 @@ namespace WixToolset.Core
54 } 54 }
55 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 55 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
56 type = 0x12; 56 type = 0x12;
57 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File 57 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.File, source); // add a reference to the appropriate File
58 break; 58 break;
59 case "PropertySource": 59 case "PropertySource":
60 if (null != source) 60 if (null != source)
@@ -317,16 +317,14 @@ namespace WixToolset.Core
317 317
318 if (!this.Core.EncounteredError) 318 if (!this.Core.EncounteredError)
319 { 319 {
320 var tuple = new MsiEmbeddedUITuple(sourceLineNumbers, id) 320 this.Core.AddTuple(new MsiEmbeddedUITuple(sourceLineNumbers, id)
321 { 321 {
322 FileName = name, 322 FileName = name,
323 EntryPoint = true, 323 EntryPoint = true,
324 SupportsBasicUI = supportsBasicUI, 324 SupportsBasicUI = supportsBasicUI,
325 MessageFilter = messageFilter, 325 MessageFilter = messageFilter,
326 Source = sourceFile 326 Source = sourceFile
327 }; 327 });
328
329 this.Core.AddTuple(tuple);
330 } 328 }
331 } 329 }
332 330
@@ -406,13 +404,11 @@ namespace WixToolset.Core
406 404
407 if (!this.Core.EncounteredError) 405 if (!this.Core.EncounteredError)
408 { 406 {
409 var tuple = new MsiEmbeddedUITuple(sourceLineNumbers, id) 407 this.Core.AddTuple(new MsiEmbeddedUITuple(sourceLineNumbers, id)
410 { 408 {
411 FileName = name, 409 FileName = name,
412 Source = sourceFile 410 Source = sourceFile
413 }; 411 });
414
415 this.Core.AddTuple(tuple);
416 } 412 }
417 } 413 }
418 } 414 }
diff --git a/src/WixToolset.Core/Compiler_Module.cs b/src/WixToolset.Core/Compiler_Module.cs
index e1563808..6166ae72 100644
--- a/src/WixToolset.Core/Compiler_Module.cs
+++ b/src/WixToolset.Core/Compiler_Module.cs
@@ -136,7 +136,7 @@ namespace WixToolset.Core
136 this.ParseCustomActionElement(child); 136 this.ParseCustomActionElement(child);
137 break; 137 break;
138 case "CustomActionRef": 138 case "CustomActionRef":
139 this.ParseSimpleRefElement(child, "CustomAction"); 139 this.ParseSimpleRefElement(child, TupleDefinitions.CustomAction);
140 break; 140 break;
141 case "CustomTable": 141 case "CustomTable":
142 this.ParseCustomTableElement(child); 142 this.ParseCustomTableElement(child);
@@ -154,7 +154,7 @@ namespace WixToolset.Core
154 this.ParseEmbeddedChainerElement(child); 154 this.ParseEmbeddedChainerElement(child);
155 break; 155 break;
156 case "EmbeddedChainerRef": 156 case "EmbeddedChainerRef":
157 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 157 this.ParseSimpleRefElement(child, TupleDefinitions.MsiEmbeddedChainer);
158 break; 158 break;
159 case "EnsureTable": 159 case "EnsureTable":
160 this.ParseEnsureTableElement(child); 160 this.ParseEnsureTableElement(child);
@@ -178,7 +178,7 @@ namespace WixToolset.Core
178 this.ParsePropertyElement(child); 178 this.ParsePropertyElement(child);
179 break; 179 break;
180 case "PropertyRef": 180 case "PropertyRef":
181 this.ParseSimpleRefElement(child, "Property"); 181 this.ParseSimpleRefElement(child, TupleDefinitions.Property);
182 break; 182 break;
183 case "SetDirectory": 183 case "SetDirectory":
184 this.ParseSetDirectoryElement(child); 184 this.ParseSetDirectoryElement(child);
@@ -197,7 +197,7 @@ namespace WixToolset.Core
197 this.ParseUIElement(child); 197 this.ParseUIElement(child);
198 break; 198 break;
199 case "UIRef": 199 case "UIRef":
200 this.ParseSimpleRefElement(child, "WixUI"); 200 this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
201 break; 201 break;
202 case "WixVariable": 202 case "WixVariable":
203 this.ParseWixVariableElement(child); 203 this.ParseWixVariableElement(child);
@@ -216,15 +216,13 @@ namespace WixToolset.Core
216 216
217 if (!this.Core.EncounteredError) 217 if (!this.Core.EncounteredError)
218 { 218 {
219 var tuple = new ModuleSignatureTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage)) 219 var tuple = this.Core.AddTuple(new ModuleSignatureTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, this.activeName, this.activeLanguage))
220 { 220 {
221 ModuleID = this.activeName, 221 ModuleID = this.activeName,
222 Version = version 222 Version = version
223 }; 223 });
224 224
225 tuple.Set((int)ModuleSignatureTupleFields.Language, this.activeLanguage); 225 tuple.Set((int)ModuleSignatureTupleFields.Language, this.activeLanguage);
226
227 this.Core.AddTuple(tuple);
228 } 226 }
229 } 227 }
230 finally 228 finally
@@ -286,17 +284,15 @@ namespace WixToolset.Core
286 284
287 if (!this.Core.EncounteredError) 285 if (!this.Core.EncounteredError)
288 { 286 {
289 var tuple = new ModuleDependencyTuple(sourceLineNumbers) 287 var tuple = this.Core.AddTuple(new ModuleDependencyTuple(sourceLineNumbers)
290 { 288 {
291 ModuleID = this.activeName, 289 ModuleID = this.activeName,
292 RequiredID = requiredId, 290 RequiredID = requiredId,
293 RequiredLanguage = requiredLanguage, 291 RequiredLanguage = requiredLanguage,
294 RequiredVersion = requiredVersion 292 RequiredVersion = requiredVersion
295 }; 293 });
296 294
297 tuple.Set((int)ModuleDependencyTupleFields.ModuleLanguage, this.activeLanguage); 295 tuple.Set((int)ModuleDependencyTupleFields.ModuleLanguage, this.activeLanguage);
298
299 this.Core.AddTuple(tuple);
300 } 296 }
301 } 297 }
302 298
@@ -369,18 +365,16 @@ namespace WixToolset.Core
369 365
370 if (!this.Core.EncounteredError) 366 if (!this.Core.EncounteredError)
371 { 367 {
372 var tuple = new ModuleExclusionTuple(sourceLineNumbers) 368 var tuple = this.Core.AddTuple(new ModuleExclusionTuple(sourceLineNumbers)
373 { 369 {
374 ModuleID = this.activeName, 370 ModuleID = this.activeName,
375 ExcludedID = excludedId, 371 ExcludedID = excludedId,
376 ExcludedMinVersion = excludedMinVersion, 372 ExcludedMinVersion = excludedMinVersion,
377 ExcludedMaxVersion = excludedMaxVersion 373 ExcludedMaxVersion = excludedMaxVersion
378 }; 374 });
379 375
380 tuple.Set((int)ModuleExclusionTupleFields.ModuleLanguage, this.activeLanguage); 376 tuple.Set((int)ModuleExclusionTupleFields.ModuleLanguage, this.activeLanguage);
381 tuple.Set((int)ModuleExclusionTupleFields.ExcludedLanguage, excludedLanguageField); 377 tuple.Set((int)ModuleExclusionTupleFields.ExcludedLanguage, excludedLanguageField);
382
383 this.Core.AddTuple(tuple);
384 } 378 }
385 } 379 }
386 380
@@ -491,7 +485,7 @@ namespace WixToolset.Core
491 485
492 if (!this.Core.EncounteredError) 486 if (!this.Core.EncounteredError)
493 { 487 {
494 var tuple = new ModuleConfigurationTuple(sourceLineNumbers, name) 488 this.Core.AddTuple(new ModuleConfigurationTuple(sourceLineNumbers, name)
495 { 489 {
496 Format = format, 490 Format = format,
497 Type = type, 491 Type = type,
@@ -503,9 +497,7 @@ namespace WixToolset.Core
503 Description = description, 497 Description = description,
504 HelpLocation = helpLocation, 498 HelpLocation = helpLocation,
505 HelpKeyword = helpKeyword 499 HelpKeyword = helpKeyword
506 }; 500 });
507
508 this.Core.AddTuple(tuple);
509 } 501 }
510 } 502 }
511 503
@@ -571,15 +563,13 @@ namespace WixToolset.Core
571 563
572 if (!this.Core.EncounteredError) 564 if (!this.Core.EncounteredError)
573 { 565 {
574 var tuple = new ModuleSubstitutionTuple(sourceLineNumbers) 566 this.Core.AddTuple(new ModuleSubstitutionTuple(sourceLineNumbers)
575 { 567 {
576 Table = table, 568 Table = table,
577 Row = rowKeys, 569 Row = rowKeys,
578 Column = column, 570 Column = column,
579 Value = value 571 Value = value
580 }; 572 });
581
582 this.Core.AddTuple(tuple);
583 } 573 }
584 } 574 }
585 575
diff --git a/src/WixToolset.Core/Compiler_Patch.cs b/src/WixToolset.Core/Compiler_Patch.cs
index f8d05132..f7481143 100644
--- a/src/WixToolset.Core/Compiler_Patch.cs
+++ b/src/WixToolset.Core/Compiler_Patch.cs
@@ -197,14 +197,12 @@ namespace WixToolset.Core
197 197
198 if (!this.Core.EncounteredError) 198 if (!this.Core.EncounteredError)
199 { 199 {
200 var tuple = new WixPatchIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, patchId)) 200 this.Core.AddTuple(new WixPatchIdTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, patchId))
201 { 201 {
202 ClientPatchId = clientPatchId, 202 ClientPatchId = clientPatchId,
203 OptimizePatchSizeForLargeFiles = optimizePatchSizeForLargeFiles, 203 OptimizePatchSizeForLargeFiles = optimizePatchSizeForLargeFiles,
204 ApiPatchingSymbolFlags = apiPatchingSymbolFlags 204 ApiPatchingSymbolFlags = apiPatchingSymbolFlags,
205 }; 205 });
206
207 this.Core.AddTuple(tuple);
208 206
209 if (allowRemoval) 207 if (allowRemoval)
210 { 208 {
@@ -427,15 +425,13 @@ namespace WixToolset.Core
427 425
428 if (!this.Core.EncounteredError) 426 if (!this.Core.EncounteredError)
429 { 427 {
430 var tuple = new MsiPatchSequenceTuple(sourceLineNumbers) 428 this.Core.AddTuple(new MsiPatchSequenceTuple(sourceLineNumbers)
431 { 429 {
432 PatchFamily = id.Id, 430 PatchFamily = id.Id,
433 ProductCode = productCode, 431 ProductCode = productCode,
434 Sequence = version, 432 Sequence = version,
435 Attributes = attributes 433 Attributes = attributes
436 }; 434 });
437
438 this.Core.AddTuple(tuple);
439 435
440 if (ComplexReferenceParentType.Unknown != parentType) 436 if (ComplexReferenceParentType.Unknown != parentType)
441 { 437 {
@@ -536,7 +532,7 @@ namespace WixToolset.Core
536 { 532 {
537 case "Id": 533 case "Id":
538 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 534 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
539 this.Core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id); 535 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixPatchFamilyGroup, id);
540 break; 536 break;
541 default: 537 default:
542 this.Core.UnexpectedAttribute(node, attrib); 538 this.Core.UnexpectedAttribute(node, attrib);
diff --git a/src/WixToolset.Core/Compiler_PatchCreation.cs b/src/WixToolset.Core/Compiler_PatchCreation.cs
index 5994795c..3371d84e 100644
--- a/src/WixToolset.Core/Compiler_PatchCreation.cs
+++ b/src/WixToolset.Core/Compiler_PatchCreation.cs
@@ -258,13 +258,13 @@ namespace WixToolset.Core
258 258
259 if (!this.Core.EncounteredError) 259 if (!this.Core.EncounteredError)
260 { 260 {
261 var tuple = new ImageFamiliesTuple(sourceLineNumbers) 261 var tuple = this.Core.AddTuple(new ImageFamiliesTuple(sourceLineNumbers)
262 { 262 {
263 Family = name, 263 Family = name,
264 MediaSrcPropName = mediaSrcProp, 264 MediaSrcPropName = mediaSrcProp,
265 DiskPrompt = diskPrompt, 265 DiskPrompt = diskPrompt,
266 VolumeLabel = volumeLabel 266 VolumeLabel = volumeLabel
267 }; 267 });
268 268
269 if (CompilerConstants.IntegerNotSet != diskId) 269 if (CompilerConstants.IntegerNotSet != diskId)
270 { 270 {
@@ -275,8 +275,6 @@ namespace WixToolset.Core
275 { 275 {
276 tuple.FileSequenceStart = sequenceStart; 276 tuple.FileSequenceStart = sequenceStart;
277 } 277 }
278
279 this.Core.AddTuple(tuple);
280 } 278 }
281 } 279 }
282 280
@@ -675,16 +673,14 @@ namespace WixToolset.Core
675 673
676 if (!this.Core.EncounteredError) 674 if (!this.Core.EncounteredError)
677 { 675 {
678 var tuple = new TargetFilesOptionalDataTuple(sourceLineNumbers) 676 var tuple = this.Core.AddTuple(new TargetFilesOptionalDataTuple(sourceLineNumbers)
679 { 677 {
680 Target = target, 678 Target = target,
681 FTK = file, 679 FTK = file,
682 SymbolPaths = symbols, 680 SymbolPaths = symbols,
683 IgnoreOffsets = ignoreOffsets, 681 IgnoreOffsets = ignoreOffsets,
684 IgnoreLengths = ignoreLengths 682 IgnoreLengths = ignoreLengths,
685 }; 683 });
686
687 this.Core.AddTuple(tuple);
688 684
689 if (null != protectOffsets) 685 if (null != protectOffsets)
690 { 686 {
@@ -695,7 +691,7 @@ namespace WixToolset.Core
695 Family = family, 691 Family = family,
696 FTK = file, 692 FTK = file,
697 RetainOffsets = protectOffsets, 693 RetainOffsets = protectOffsets,
698 RetainLengths = protectLengths 694 RetainLengths = protectLengths,
699 }); 695 });
700 } 696 }
701 } 697 }
@@ -797,15 +793,15 @@ namespace WixToolset.Core
797 793
798 if (!this.Core.EncounteredError) 794 if (!this.Core.EncounteredError)
799 { 795 {
800 var tuple = new ExternalFilesTuple(sourceLineNumbers) 796 var tuple = this.Core.AddTuple(new ExternalFilesTuple(sourceLineNumbers)
801 { 797 {
802 Family = family, 798 Family = family,
803 FTK = file, 799 FTK = file,
804 FilePath = source, 800 FilePath = source,
805 SymbolPaths = symbols, 801 SymbolPaths = symbols,
806 IgnoreOffsets = ignoreOffsets, 802 IgnoreOffsets = ignoreOffsets,
807 IgnoreLengths = ignoreLengths 803 IgnoreLengths = ignoreLengths,
808 }; 804 });
809 805
810 if (null != protectOffsets) 806 if (null != protectOffsets)
811 { 807 {
@@ -817,8 +813,6 @@ namespace WixToolset.Core
817 tuple.Order = order; 813 tuple.Order = order;
818 } 814 }
819 815
820 this.Core.AddTuple(tuple);
821
822 if (null != protectOffsets) 816 if (null != protectOffsets)
823 { 817 {
824 this.Core.AddTuple(new FamilyFileRangesTuple(sourceLineNumbers) 818 this.Core.AddTuple(new FamilyFileRangesTuple(sourceLineNumbers)
@@ -826,7 +820,7 @@ namespace WixToolset.Core
826 Family = family, 820 Family = family,
827 FTK = file, 821 FTK = file,
828 RetainOffsets = protectOffsets, 822 RetainOffsets = protectOffsets,
829 RetainLengths = protectLengths 823 RetainLengths = protectLengths,
830 }); 824 });
831 } 825 }
832 } 826 }
@@ -1257,7 +1251,7 @@ namespace WixToolset.Core
1257 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode")); 1251 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode"));
1258 } 1252 }
1259 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1253 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1260 this.Core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target); 1254 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.TargetImages, target);
1261 break; 1255 break;
1262 case "Sequence": 1256 case "Sequence":
1263 sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 1257 sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
@@ -1288,15 +1282,13 @@ namespace WixToolset.Core
1288 1282
1289 if (!this.Core.EncounteredError) 1283 if (!this.Core.EncounteredError)
1290 { 1284 {
1291 var tuple = new PatchSequenceTuple(sourceLineNumbers) 1285 this.Core.AddTuple(new PatchSequenceTuple(sourceLineNumbers)
1292 { 1286 {
1293 PatchFamily = family, 1287 PatchFamily = family,
1294 Target = target, 1288 Target = target,
1295 Sequence = sequence, 1289 Sequence = sequence,
1296 Supersede = attributes 1290 Supersede = attributes,
1297 }; 1291 });
1298
1299 this.Core.AddTuple(tuple);
1300 } 1292 }
1301 } 1293 }
1302 1294
@@ -1306,7 +1298,7 @@ namespace WixToolset.Core
1306 { 1298 {
1307 Company = company, 1299 Company = company,
1308 Property = property, 1300 Property = property,
1309 Value = value 1301 Value = value,
1310 }); 1302 });
1311 } 1303 }
1312 } 1304 }
diff --git a/src/WixToolset.Core/Compiler_UI.cs b/src/WixToolset.Core/Compiler_UI.cs
index 60e89d12..3d554f12 100644
--- a/src/WixToolset.Core/Compiler_UI.cs
+++ b/src/WixToolset.Core/Compiler_UI.cs
@@ -76,7 +76,7 @@ namespace WixToolset.Core
76 this.ParseDialogElement(child); 76 this.ParseDialogElement(child);
77 break; 77 break;
78 case "DialogRef": 78 case "DialogRef":
79 this.ParseSimpleRefElement(child, "Dialog"); 79 this.ParseSimpleRefElement(child, TupleDefinitions.Dialog);
80 break; 80 break;
81 case "EmbeddedUI": 81 case "EmbeddedUI":
82 if (0 < embeddedUICount) // there can be only one embedded UI 82 if (0 < embeddedUICount) // there can be only one embedded UI
@@ -132,10 +132,10 @@ namespace WixToolset.Core
132 this.ParsePropertyElement(child); 132 this.ParsePropertyElement(child);
133 break; 133 break;
134 case "PropertyRef": 134 case "PropertyRef":
135 this.ParseSimpleRefElement(child, "Property"); 135 this.ParseSimpleRefElement(child, TupleDefinitions.Property);
136 break; 136 break;
137 case "UIRef": 137 case "UIRef":
138 this.ParseSimpleRefElement(child, "WixUI"); 138 this.ParseSimpleRefElement(child, TupleDefinitions.WixUI);
139 break; 139 break;
140 140
141 default: 141 default:
@@ -151,8 +151,7 @@ namespace WixToolset.Core
151 151
152 if (null != id && !this.Core.EncounteredError) 152 if (null != id && !this.Core.EncounteredError)
153 { 153 {
154 var tuple = new WixUITuple(sourceLineNumbers, id); 154 this.Core.AddTuple(new WixUITuple(sourceLineNumbers, id));
155 this.Core.AddTuple(tuple);
156 } 155 }
157 } 156 }
158 157
@@ -160,7 +159,7 @@ namespace WixToolset.Core
160 /// Parses a list item element. 159 /// Parses a list item element.
161 /// </summary> 160 /// </summary>
162 /// <param name="node">Element to parse.</param> 161 /// <param name="node">Element to parse.</param>
163 /// <param name="table">Table to add row to.</param> 162 /// <param name="tupleType">Type of tuple to create.</param>
164 /// <param name="property">Identifier of property referred to by list item.</param> 163 /// <param name="property">Identifier of property referred to by list item.</param>
165 /// <param name="order">Relative order of list items.</param> 164 /// <param name="order">Relative order of list items.</param>
166 private void ParseListItemElement(XElement node, TupleDefinitionType tupleType, string property, ref int order) 165 private void ParseListItemElement(XElement node, TupleDefinitionType tupleType, string property, ref int order)
@@ -180,7 +179,7 @@ namespace WixToolset.Core
180 if (TupleDefinitionType.ListView == tupleType) 179 if (TupleDefinitionType.ListView == tupleType)
181 { 180 {
182 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 181 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
183 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", icon); 182 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, icon);
184 } 183 }
185 else 184 else
186 { 185 {
@@ -213,14 +212,42 @@ namespace WixToolset.Core
213 212
214 if (!this.Core.EncounteredError) 213 if (!this.Core.EncounteredError)
215 { 214 {
216 var tuple = this.Core.CreateTuple(sourceLineNumbers, tupleType); 215 switch (tupleType)
217 tuple.Set(0, property);
218 tuple.Set(1, ++order);
219 tuple.Set(2, value);
220 tuple.Set(3, text);
221 if (null != icon)
222 { 216 {
223 tuple.Set(4, icon); 217 case TupleDefinitionType.ComboBox:
218 this.Core.AddTuple(new ComboBoxTuple(sourceLineNumbers)
219 {
220 Property = property,
221 Order = ++order,
222 Value = value,
223 Text = text,
224 });
225 break;
226 case TupleDefinitionType.ListBox:
227 this.Core.AddTuple(new ListBoxTuple(sourceLineNumbers)
228 {
229 Property = property,
230 Order = ++order,
231 Value = value,
232 Text = text,
233 });
234 break;
235 case TupleDefinitionType.ListView:
236 var tuple = this.Core.AddTuple(new ListViewTuple(sourceLineNumbers)
237 {
238 Property = property,
239 Order = ++order,
240 Value = value,
241 Text = text,
242 });
243
244 if (null != icon)
245 {
246 tuple.BinaryRef = icon;
247 }
248 break;
249 default:
250 throw new ArgumentOutOfRangeException(nameof(tupleType));
224 } 251 }
225 } 252 }
226 } 253 }
@@ -257,7 +284,7 @@ namespace WixToolset.Core
257 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text")); 284 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text"));
258 } 285 }
259 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 286 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
260 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); 287 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
261 type = RadioButtonType.Bitmap; 288 type = RadioButtonType.Bitmap;
262 break; 289 break;
263 case "Height": 290 case "Height":
@@ -272,7 +299,7 @@ namespace WixToolset.Core
272 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text")); 299 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text"));
273 } 300 }
274 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 301 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
275 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); 302 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
276 type = RadioButtonType.Icon; 303 type = RadioButtonType.Icon;
277 break; 304 break;
278 case "Text": 305 case "Text":
@@ -338,21 +365,19 @@ namespace WixToolset.Core
338 365
339 if (!this.Core.EncounteredError) 366 if (!this.Core.EncounteredError)
340 { 367 {
341 var tuple = new RadioButtonTuple(sourceLineNumbers) 368 var tuple = this.Core.AddTuple(new RadioButtonTuple(sourceLineNumbers)
342 { 369 {
343 Property = property, 370 Property = property,
344 Order = ++order, 371 Order = ++order,
345 Value = value, 372 Value = value,
346 Text = text, 373 Text = text,
347 Help = (null != tooltip || null != help) ? String.Concat(tooltip, "|", help) : null 374 Help = (null != tooltip || null != help) ? String.Concat(tooltip, "|", help) : null
348 }; 375 });
349 376
350 tuple.Set((int)RadioButtonTupleFields.X, x); 377 tuple.Set((int)RadioButtonTupleFields.X, x);
351 tuple.Set((int)RadioButtonTupleFields.Y, y); 378 tuple.Set((int)RadioButtonTupleFields.Y, y);
352 tuple.Set((int)RadioButtonTupleFields.Width, width); 379 tuple.Set((int)RadioButtonTupleFields.Width, width);
353 tuple.Set((int)RadioButtonTupleFields.Height, height); 380 tuple.Set((int)RadioButtonTupleFields.Height, height);
354
355 this.Core.AddTuple(tuple);
356 } 381 }
357 382
358 return type; 383 return type;
@@ -376,7 +401,7 @@ namespace WixToolset.Core
376 { 401 {
377 case "Id": 402 case "Id":
378 action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 403 action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
379 this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action); 404 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.WixAction, "InstallExecuteSequence", action);
380 break; 405 break;
381 default: 406 default:
382 this.Core.UnexpectedAttribute(node, attrib); 407 this.Core.UnexpectedAttribute(node, attrib);
@@ -439,7 +464,7 @@ namespace WixToolset.Core
439 break; 464 break;
440 case "Feature": 465 case "Feature":
441 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 466 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
442 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); 467 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Feature, feature);
443 break; 468 break;
444 default: 469 default:
445 this.Core.UnexpectedAttribute(node, attrib); 470 this.Core.UnexpectedAttribute(node, attrib);
@@ -486,14 +511,12 @@ namespace WixToolset.Core
486 511
487 if (!this.Core.EncounteredError) 512 if (!this.Core.EncounteredError)
488 { 513 {
489 var tuple = new BillboardTuple(sourceLineNumbers, id) 514 this.Core.AddTuple(new BillboardTuple(sourceLineNumbers, id)
490 { 515 {
491 FeatureRef = feature, 516 FeatureRef = feature,
492 Action = action, 517 Action = action,
493 Ordering = order 518 Ordering = order
494 }; 519 });
495
496 this.Core.AddTuple(tuple);
497 } 520 }
498 } 521 }
499 522
@@ -501,7 +524,7 @@ namespace WixToolset.Core
501 /// Parses a control group element. 524 /// Parses a control group element.
502 /// </summary> 525 /// </summary>
503 /// <param name="node">Element to parse.</param> 526 /// <param name="node">Element to parse.</param>
504 /// <param name="table">Table referred to by control group.</param> 527 /// <param name="tupleType">Tuple type referred to by control group.</param>
505 /// <param name="childTag">Expected child elements.</param> 528 /// <param name="childTag">Expected child elements.</param>
506 private void ParseControlGroupElement(XElement node, TupleDefinitionType tupleType, string childTag) 529 private void ParseControlGroupElement(XElement node, TupleDefinitionType tupleType, string childTag)
507 { 530 {
@@ -584,7 +607,7 @@ namespace WixToolset.Core
584 { 607 {
585 case "Property": 608 case "Property":
586 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 609 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
587 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); 610 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Property, property);
588 break; 611 break;
589 default: 612 default:
590 this.Core.UnexpectedAttribute(node, attrib); 613 this.Core.UnexpectedAttribute(node, attrib);
@@ -677,14 +700,12 @@ namespace WixToolset.Core
677 700
678 if (!this.Core.EncounteredError) 701 if (!this.Core.EncounteredError)
679 { 702 {
680 var tuple = new ActionTextTuple(sourceLineNumbers) 703 this.Core.AddTuple(new ActionTextTuple(sourceLineNumbers)
681 { 704 {
682 Action = action, 705 Action = action,
683 Description = Common.GetInnerText(node), 706 Description = Common.GetInnerText(node),
684 Template = template 707 Template = template,
685 }; 708 });
686
687 this.Core.AddTuple(tuple);
688 } 709 }
689 } 710 }
690 711
@@ -729,12 +750,10 @@ namespace WixToolset.Core
729 750
730 if (!this.Core.EncounteredError) 751 if (!this.Core.EncounteredError)
731 { 752 {
732 var tuple = new UITextTuple(sourceLineNumbers, id) 753 this.Core.AddTuple(new UITextTuple(sourceLineNumbers, id)
733 { 754 {
734 Text = text, 755 Text = text,
735 }; 756 });
736
737 this.Core.AddTuple(tuple);
738 } 757 }
739 } 758 }
740 759
@@ -836,7 +855,7 @@ namespace WixToolset.Core
836 855
837 if (!this.Core.EncounteredError) 856 if (!this.Core.EncounteredError)
838 { 857 {
839 var tuple = new TextStyleTuple(sourceLineNumbers, id) 858 var tuple = this.Core.AddTuple(new TextStyleTuple(sourceLineNumbers, id)
840 { 859 {
841 FaceName = faceName, 860 FaceName = faceName,
842 Red = red, 861 Red = red,
@@ -846,11 +865,9 @@ namespace WixToolset.Core
846 Italic = italic, 865 Italic = italic,
847 Strike = strike, 866 Strike = strike,
848 Underline = underline, 867 Underline = underline,
849 }; 868 });
850 869
851 tuple.Set((int)TextStyleTupleFields.Size, size); 870 tuple.Set((int)TextStyleTupleFields.Size, size);
852
853 this.Core.AddTuple(tuple);
854 } 871 }
855 } 872 }
856 873
@@ -994,7 +1011,7 @@ namespace WixToolset.Core
994 1011
995 if (!this.Core.EncounteredError) 1012 if (!this.Core.EncounteredError)
996 { 1013 {
997 var tuple = new DialogTuple(sourceLineNumbers, id) 1014 this.Core.AddTuple(new DialogTuple(sourceLineNumbers, id)
998 { 1015 {
999 HCentering = x, 1016 HCentering = x,
1000 VCentering = y, 1017 VCentering = y,
@@ -1015,9 +1032,7 @@ namespace WixToolset.Core
1015 FirstControlRef = firstControl, 1032 FirstControlRef = firstControl,
1016 DefaultControlRef = defaultControl, 1033 DefaultControlRef = defaultControl,
1017 CancelControlRef = cancelControl, 1034 CancelControlRef = cancelControl,
1018 }; 1035 });
1019
1020 this.Core.AddTuple(tuple);
1021 } 1036 }
1022 } 1037 }
1023 1038
@@ -1083,7 +1098,7 @@ namespace WixToolset.Core
1083 notTabbable = true; 1098 notTabbable = true;
1084 disabled = true; 1099 disabled = true;
1085 1100
1086 this.Core.EnsureTable(sourceLineNumbers, "Billboard"); 1101 this.Core.EnsureTable(sourceLineNumbers, WindowsInstallerTableDefinitions.Billboard);
1087 break; 1102 break;
1088 case "Bitmap": 1103 case "Bitmap":
1089 specialAttributes = BitmapControlAttributes; 1104 specialAttributes = BitmapControlAttributes;
@@ -1449,17 +1464,15 @@ namespace WixToolset.Core
1449 } 1464 }
1450 else if (!String.IsNullOrEmpty(property)) 1465 else if (!String.IsNullOrEmpty(property))
1451 { 1466 {
1452 var checkBoxTuple = new CheckBoxTuple(sourceLineNumbers) 1467 this.Core.AddTuple(new CheckBoxTuple(sourceLineNumbers)
1453 { 1468 {
1454 Property = property, 1469 Property = property,
1455 Value = checkboxValue 1470 Value = checkboxValue,
1456 }; 1471 });
1457
1458 this.Core.AddTuple(checkBoxTuple);
1459 } 1472 }
1460 else 1473 else
1461 { 1474 {
1462 this.Core.CreateSimpleReference(sourceLineNumbers, "CheckBox", checkBoxPropertyRef); 1475 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.CheckBox, checkBoxPropertyRef);
1463 } 1476 }
1464 } 1477 }
1465 1478
@@ -1467,7 +1480,7 @@ namespace WixToolset.Core
1467 1480
1468 if (TupleDefinitionType.BBControl == tupleType) 1481 if (TupleDefinitionType.BBControl == tupleType)
1469 { 1482 {
1470 var bbTuple = new BBControlTuple(sourceLineNumbers, id) 1483 var bbTuple = this.Core.AddTuple(new BBControlTuple(sourceLineNumbers, id)
1471 { 1484 {
1472 BillboardRef = dialog, 1485 BillboardRef = dialog,
1473 BBControl = controlId.Id, 1486 BBControl = controlId.Id,
@@ -1482,21 +1495,19 @@ namespace WixToolset.Core
1482 Sunken = sunken, 1495 Sunken = sunken,
1483 Visible = !hidden, 1496 Visible = !hidden,
1484 Text = text, 1497 Text = text,
1485 SourceFile = sourceFile 1498 SourceFile = sourceFile,
1486 }; 1499 });
1487 1500
1488 bbTuple.Set((int)BBControlTupleFields.X, x); 1501 bbTuple.Set((int)BBControlTupleFields.X, x);
1489 bbTuple.Set((int)BBControlTupleFields.Y, y); 1502 bbTuple.Set((int)BBControlTupleFields.Y, y);
1490 bbTuple.Set((int)BBControlTupleFields.Width, width); 1503 bbTuple.Set((int)BBControlTupleFields.Width, width);
1491 bbTuple.Set((int)BBControlTupleFields.Height, height); 1504 bbTuple.Set((int)BBControlTupleFields.Height, height);
1492 1505
1493 this.Core.AddTuple(bbTuple);
1494
1495 tuple = bbTuple; 1506 tuple = bbTuple;
1496 } 1507 }
1497 else 1508 else
1498 { 1509 {
1499 var controlTuple = new ControlTuple(sourceLineNumbers, id) 1510 var controlTuple = this.Core.AddTuple(new ControlTuple(sourceLineNumbers, id)
1500 { 1511 {
1501 DialogRef = dialog, 1512 DialogRef = dialog,
1502 Control = controlId.Id, 1513 Control = controlId.Id,
@@ -1514,15 +1525,13 @@ namespace WixToolset.Core
1514 Text = text, 1525 Text = text,
1515 Help = (null == tooltip && null == help) ? null : String.Concat(tooltip, "|", help), // Separator is required, even if only one is non-null.}; 1526 Help = (null == tooltip && null == help) ? null : String.Concat(tooltip, "|", help), // Separator is required, even if only one is non-null.};
1516 SourceFile = sourceFile 1527 SourceFile = sourceFile
1517 }; 1528 });
1518 1529
1519 controlTuple.Set((int)BBControlTupleFields.X, x); 1530 controlTuple.Set((int)BBControlTupleFields.X, x);
1520 controlTuple.Set((int)BBControlTupleFields.Y, y); 1531 controlTuple.Set((int)BBControlTupleFields.Y, y);
1521 controlTuple.Set((int)BBControlTupleFields.Width, width); 1532 controlTuple.Set((int)BBControlTupleFields.Width, width);
1522 controlTuple.Set((int)BBControlTupleFields.Height, height); 1533 controlTuple.Set((int)BBControlTupleFields.Height, height);
1523 1534
1524 this.Core.AddTuple(controlTuple);
1525
1526 tuple = controlTuple; 1535 tuple = controlTuple;
1527 } 1536 }
1528 } 1537 }
@@ -1552,7 +1561,7 @@ namespace WixToolset.Core
1552 // add a reference if the identifier of the binary entry is known during compilation 1561 // add a reference if the identifier of the binary entry is known during compilation
1553 if (("Bitmap" == controlType || "Icon" == controlType) && Common.IsIdentifier(text)) 1562 if (("Bitmap" == controlType || "Icon" == controlType) && Common.IsIdentifier(text))
1554 { 1563 {
1555 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); 1564 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Binary, text);
1556 } 1565 }
1557 } 1566 }
1558 1567
@@ -1593,7 +1602,7 @@ namespace WixToolset.Core
1593 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); 1602 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
1594 } 1603 }
1595 dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1604 dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1596 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog); 1605 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, dialog);
1597 break; 1606 break;
1598 case "Event": 1607 case "Event":
1599 controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); 1608 controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib));
@@ -1656,7 +1665,7 @@ namespace WixToolset.Core
1656 1665
1657 if (!this.Core.EncounteredError) 1666 if (!this.Core.EncounteredError)
1658 { 1667 {
1659 var tuple = new ControlEventTuple(sourceLineNumbers) 1668 this.Core.AddTuple(new ControlEventTuple(sourceLineNumbers)
1660 { 1669 {
1661 DialogRef = dialog, 1670 DialogRef = dialog,
1662 ControlRef = control, 1671 ControlRef = control,
@@ -1664,9 +1673,7 @@ namespace WixToolset.Core
1664 Argument = argument, 1673 Argument = argument,
1665 Condition = condition, 1674 Condition = condition,
1666 Ordering = order 1675 Ordering = order
1667 }; 1676 });
1668
1669 this.Core.AddTuple(tuple);
1670 } 1677 }
1671 1678
1672 if ("DoAction" == controlEvent && null != argument) 1679 if ("DoAction" == controlEvent && null != argument)
@@ -1675,14 +1682,14 @@ namespace WixToolset.Core
1675 // to the custom action. 1682 // to the custom action.
1676 if (!WindowsInstallerStandard.IsStandardAction(argument) && !Common.ContainsProperty(argument)) 1683 if (!WindowsInstallerStandard.IsStandardAction(argument) && !Common.ContainsProperty(argument))
1677 { 1684 {
1678 this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", argument); 1685 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.CustomAction, argument);
1679 } 1686 }
1680 } 1687 }
1681 1688
1682 // if we're referring to a dialog but not through a property, add it to the references 1689 // if we're referring to a dialog but not through a property, add it to the references
1683 if (("NewDialog" == controlEvent || "SpawnDialog" == controlEvent || "SpawnWaitDialog" == controlEvent || "SelectionBrowse" == controlEvent) && Common.IsIdentifier(argument)) 1690 if (("NewDialog" == controlEvent || "SpawnDialog" == controlEvent || "SpawnWaitDialog" == controlEvent || "SelectionBrowse" == controlEvent) && Common.IsIdentifier(argument))
1684 { 1691 {
1685 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", argument); 1692 this.Core.CreateSimpleReference(sourceLineNumbers, TupleDefinitions.Dialog, argument);
1686 } 1693 }
1687 } 1694 }
1688 1695
@@ -1725,15 +1732,13 @@ namespace WixToolset.Core
1725 1732
1726 if (!this.Core.EncounteredError) 1733 if (!this.Core.EncounteredError)
1727 { 1734 {
1728 var tuple = new EventMappingTuple(sourceLineNumbers) 1735 this.Core.AddTuple(new EventMappingTuple(sourceLineNumbers)
1729 { 1736 {
1730 DialogRef = dialog, 1737 DialogRef = dialog,
1731 ControlRef = control, 1738 ControlRef = control,
1732 Event = eventMapping, 1739 Event = eventMapping,
1733 Attribute = controlAttribute 1740 Attribute = controlAttribute,
1734 }; ; 1741 });
1735
1736 this.Core.AddTuple(tuple);
1737 } 1742 }
1738 } 1743 }
1739 } 1744 }
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
index f07e4638..3c092bd4 100644
--- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
@@ -54,7 +54,7 @@ namespace WixToolset.Core.ExtensibilityServices
54 public void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary) 54 public void CreateComplexReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, ComplexReferenceParentType parentType, string parentId, string parentLanguage, ComplexReferenceChildType childType, string childId, bool isPrimary)
55 { 55 {
56 56
57 var tuple = new WixComplexReferenceTuple(sourceLineNumbers) 57 section.AddTuple(new WixComplexReferenceTuple(sourceLineNumbers)
58 { 58 {
59 Parent = parentId, 59 Parent = parentId,
60 ParentType = parentType, 60 ParentType = parentType,
@@ -62,9 +62,7 @@ namespace WixToolset.Core.ExtensibilityServices
62 Child = childId, 62 Child = childId,
63 ChildType = childType, 63 ChildType = childType,
64 IsPrimary = isPrimary 64 IsPrimary = isPrimary
65 }; 65 });
66
67 section.Tuples.Add(tuple);
68 66
69 this.CreateWixGroupTuple(section, sourceLineNumbers, parentType, parentId, childType, childId); 67 this.CreateWixGroupTuple(section, sourceLineNumbers, parentType, parentId, childType, childId);
70 } 68 }
@@ -100,24 +98,22 @@ namespace WixToolset.Core.ExtensibilityServices
100 } 98 }
101 } 99 }
102 100
103 var tuple = new DirectoryTuple(sourceLineNumbers, id) 101 var tuple = section.AddTuple(new DirectoryTuple(sourceLineNumbers, id)
104 { 102 {
105 ParentDirectoryRef = parentId, 103 ParentDirectoryRef = parentId,
106 Name = name, 104 Name = name,
107 ShortName = shortName, 105 ShortName = shortName,
108 SourceName = sourceName, 106 SourceName = sourceName,
109 SourceShortName = shortSourceName 107 SourceShortName = shortSourceName
110 }; 108 });
111
112 section.Tuples.Add(tuple);
113 109
114 return id; 110 return tuple.Id;
115 } 111 }
116 112
117 public string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, string parentId, XAttribute attribute, ISet<string> sectionInlinedDirectoryIds) 113 public string CreateDirectoryReferenceFromInlineSyntax(IntermediateSection section, SourceLineNumber sourceLineNumbers, string parentId, XAttribute attribute, ISet<string> sectionInlinedDirectoryIds)
118 { 114 {
119 string id = null; 115 string id = null;
120 string[] inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true); 116 var inlineSyntax = this.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, true);
121 117
122 if (null != inlineSyntax) 118 if (null != inlineSyntax)
123 { 119 {
@@ -126,13 +122,13 @@ namespace WixToolset.Core.ExtensibilityServices
126 if (1 == inlineSyntax.Length) 122 if (1 == inlineSyntax.Length)
127 { 123 {
128 id = inlineSyntax[0]; 124 id = inlineSyntax[0];
129 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.Directory), id); 125 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, id);
130 } 126 }
131 else // start creating tuples for the entries in the inline syntax 127 else // start creating tuples for the entries in the inline syntax
132 { 128 {
133 id = parentId; 129 id = parentId;
134 130
135 int pathStartsAt = 0; 131 var pathStartsAt = 0;
136 if (inlineSyntax[0].EndsWith(":")) 132 if (inlineSyntax[0].EndsWith(":"))
137 { 133 {
138 // TODO: should overriding the parent identifier with a specific id be an error or a warning or just let it slide? 134 // TODO: should overriding the parent identifier with a specific id be an error or a warning or just let it slide?
@@ -142,14 +138,14 @@ namespace WixToolset.Core.ExtensibilityServices
142 //} 138 //}
143 139
144 id = inlineSyntax[0].TrimEnd(':'); 140 id = inlineSyntax[0].TrimEnd(':');
145 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.Directory), id); 141 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, id);
146 142
147 pathStartsAt = 1; 143 pathStartsAt = 1;
148 } 144 }
149 145
150 for (int i = pathStartsAt; i < inlineSyntax.Length; ++i) 146 for (var i = pathStartsAt; i < inlineSyntax.Length; ++i)
151 { 147 {
152 Identifier inlineId = this.CreateDirectoryTuple(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds); 148 var inlineId = this.CreateDirectoryTuple(section, sourceLineNumbers, null, id, inlineSyntax[i], sectionInlinedDirectoryIds);
153 id = inlineId.Id; 149 id = inlineId.Id;
154 } 150 }
155 } 151 }
@@ -206,29 +202,25 @@ namespace WixToolset.Core.ExtensibilityServices
206 202
207 var id = this.CreateIdentifier("reg", componentId, ((int)root).ToString(CultureInfo.InvariantCulture.NumberFormat), key.ToLowerInvariant(), (null != name ? name.ToLowerInvariant() : name)); 203 var id = this.CreateIdentifier("reg", componentId, ((int)root).ToString(CultureInfo.InvariantCulture.NumberFormat), key.ToLowerInvariant(), (null != name ? name.ToLowerInvariant() : name));
208 204
209 var tuple = new RegistryTuple(sourceLineNumbers, id) 205 var tuple = section.AddTuple(new RegistryTuple(sourceLineNumbers, id)
210 { 206 {
211 Root = root, 207 Root = root,
212 Key = key, 208 Key = key,
213 Name = name, 209 Name = name,
214 Value = value, 210 Value = value,
215 ComponentRef = componentId, 211 ComponentRef = componentId,
216 }; 212 });
217
218 section.Tuples.Add(tuple);
219 213
220 return id; 214 return tuple.Id;
221 } 215 }
222 216
223 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys) 217 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys)
224 { 218 {
225 var tuple = new WixSimpleReferenceTuple(sourceLineNumbers) 219 section.AddTuple(new WixSimpleReferenceTuple(sourceLineNumbers)
226 { 220 {
227 Table = tupleName, 221 Table = tupleName,
228 PrimaryKeys = String.Join("/", primaryKeys) 222 PrimaryKeys = String.Join("/", primaryKeys)
229 }; 223 });
230
231 section.Tuples.Add(tuple);
232 } 224 }
233 225
234 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys) 226 public void CreateSimpleReference(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys)
@@ -254,15 +246,13 @@ namespace WixToolset.Core.ExtensibilityServices
254 throw new ArgumentNullException("childId"); 246 throw new ArgumentNullException("childId");
255 } 247 }
256 248
257 var tuple = new WixGroupTuple(sourceLineNumbers) 249 section.AddTuple(new WixGroupTuple(sourceLineNumbers)
258 { 250 {
259 ParentId = parentId, 251 ParentId = parentId,
260 ParentType = parentType, 252 ParentType = parentType,
261 ChildId = childId, 253 ChildId = childId,
262 ChildType = childType, 254 ChildType = childType,
263 }; 255 });
264
265 section.Tuples.Add(tuple);
266 } 256 }
267 257
268 public void CreateWixSearchTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId) 258 public void CreateWixSearchTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after, string bundleExtensionId)
@@ -273,7 +263,7 @@ namespace WixToolset.Core.ExtensibilityServices
273 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, elementName, "Variable")); 263 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, elementName, "Variable"));
274 } 264 }
275 265
276 section.Tuples.Add(new WixSearchTuple(sourceLineNumbers, id) 266 section.AddTuple(new WixSearchTuple(sourceLineNumbers, id)
277 { 267 {
278 Variable = variable, 268 Variable = variable,
279 Condition = condition, 269 Condition = condition,
@@ -282,20 +272,20 @@ namespace WixToolset.Core.ExtensibilityServices
282 272
283 if (after != null) 273 if (after != null)
284 { 274 {
285 this.CreateSimpleReference(section, sourceLineNumbers, "WixSearch", after); 275 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixSearch, after);
286 // TODO: We're currently defaulting to "always run after", which we will need to change... 276 // TODO: We're currently defaulting to "always run after", which we will need to change...
287 this.CreateWixSearchRelationTuple(section, sourceLineNumbers, id, after, 2); 277 this.CreateWixSearchRelationTuple(section, sourceLineNumbers, id, after, 2);
288 } 278 }
289 279
290 if (!String.IsNullOrEmpty(bundleExtensionId)) 280 if (!String.IsNullOrEmpty(bundleExtensionId))
291 { 281 {
292 this.CreateSimpleReference(section, sourceLineNumbers, "WixBundleExtension", bundleExtensionId); 282 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixBundleExtension, bundleExtensionId);
293 } 283 }
294 } 284 }
295 285
296 public void CreateWixSearchRelationTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes) 286 public void CreateWixSearchRelationTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, int attributes)
297 { 287 {
298 section.Tuples.Add(new WixSearchRelationTuple(sourceLineNumbers, id) 288 section.AddTuple(new WixSearchRelationTuple(sourceLineNumbers, id)
299 { 289 {
300 ParentSearchRef = parentId, 290 ParentSearchRef = parentId,
301 Attributes = attributes, 291 Attributes = attributes,
@@ -351,13 +341,13 @@ namespace WixToolset.Core.ExtensibilityServices
351 } 341 }
352 342
353 // collect all the data 343 // collect all the data
354 List<string> strings = new List<string>(1 + args.Length); 344 var strings = new List<string>(1 + args.Length);
355 strings.Add(longName); 345 strings.Add(longName);
356 strings.AddRange(args); 346 strings.AddRange(args);
357 347
358 // prepare for hashing 348 // prepare for hashing
359 string stringData = String.Join("|", strings); 349 var stringData = String.Join("|", strings);
360 byte[] data = Encoding.UTF8.GetBytes(stringData); 350 var data = Encoding.UTF8.GetBytes(stringData);
361 351
362 // hash the data 352 // hash the data
363 byte[] hash; 353 byte[] hash;
@@ -367,12 +357,12 @@ namespace WixToolset.Core.ExtensibilityServices
367 } 357 }
368 358
369 // generate the short file/directory name without an extension 359 // generate the short file/directory name without an extension
370 StringBuilder shortName = new StringBuilder(Convert.ToBase64String(hash)); 360 var shortName = new StringBuilder(Convert.ToBase64String(hash));
371 shortName.Remove(8, shortName.Length - 8).Replace('+', '-').Replace('/', '_'); 361 shortName.Remove(8, shortName.Length - 8).Replace('+', '-').Replace('/', '_');
372 362
373 if (keepExtension) 363 if (keepExtension)
374 { 364 {
375 string extension = Path.GetExtension(longName); 365 var extension = Path.GetExtension(longName);
376 366
377 if (4 < extension.Length) 367 if (4 < extension.Length)
378 { 368 {
@@ -405,9 +395,9 @@ namespace WixToolset.Core.ExtensibilityServices
405 395
406 public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName) 396 public void EnsureTable(IntermediateSection section, SourceLineNumber sourceLineNumbers, string tableName)
407 { 397 {
408 section.Tuples.Add(new WixEnsureTableTuple(sourceLineNumbers) 398 section.AddTuple(new WixEnsureTableTuple(sourceLineNumbers)
409 { 399 {
410 Table = tableName 400 Table = tableName,
411 }); 401 });
412 402
413 if (this.Creator == null) 403 if (this.Creator == null)
@@ -419,7 +409,7 @@ namespace WixToolset.Core.ExtensibilityServices
419 // We don't add custom table definitions to the tableDefinitions collection, 409 // We don't add custom table definitions to the tableDefinitions collection,
420 // so if it's not in there, it better be a custom table. If the Id is just wrong, 410 // so if it's not in there, it better be a custom table. If the Id is just wrong,
421 // instead of a custom table, we get an unresolved reference at link time. 411 // instead of a custom table, we get an unresolved reference at link time.
422 if (!this.Creator.TryGetTupleDefinitionByName(tableName, out var ignored)) 412 if (!this.Creator.TryGetTupleDefinitionByName(tableName, out var _))
423 { 413 {
424 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixCustomTable, tableName); 414 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixCustomTable, tableName);
425 } 415 }
@@ -432,8 +422,8 @@ namespace WixToolset.Core.ExtensibilityServices
432 throw new ArgumentNullException("attribute"); 422 throw new ArgumentNullException("attribute");
433 } 423 }
434 424
435 EmptyRule emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly; 425 var emptyRule = canBeEmpty ? EmptyRule.CanBeEmpty : EmptyRule.CanBeWhitespaceOnly;
436 string value = this.GetAttributeValue(sourceLineNumbers, attribute, emptyRule); 426 var value = this.GetAttributeValue(sourceLineNumbers, attribute, emptyRule);
437 427
438 if (String.IsNullOrEmpty(value) && canBeEmpty) 428 if (String.IsNullOrEmpty(value) && canBeEmpty)
439 { 429 {
@@ -516,15 +506,15 @@ namespace WixToolset.Core.ExtensibilityServices
516 public string[] GetAttributeInlineDirectorySyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool resultUsedToCreateReference = false) 506 public string[] GetAttributeInlineDirectorySyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool resultUsedToCreateReference = false)
517 { 507 {
518 string[] result = null; 508 string[] result = null;
519 string value = this.GetAttributeValue(sourceLineNumbers, attribute); 509 var value = this.GetAttributeValue(sourceLineNumbers, attribute);
520 510
521 if (!String.IsNullOrEmpty(value)) 511 if (!String.IsNullOrEmpty(value))
522 { 512 {
523 int pathStartsAt = 0; 513 var pathStartsAt = 0;
524 result = value.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); 514 result = value.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
525 if (result[0].EndsWith(":", StringComparison.Ordinal)) 515 if (result[0].EndsWith(":", StringComparison.Ordinal))
526 { 516 {
527 string id = result[0].TrimEnd(':'); 517 var id = result[0].TrimEnd(':');
528 if (1 == result.Length) 518 if (1 == result.Length)
529 { 519 {
530 this.Messaging.Write(ErrorMessages.InlineDirectorySyntaxRequiresPath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, id)); 520 this.Messaging.Write(ErrorMessages.InlineDirectorySyntaxRequiresPath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, id));
@@ -558,7 +548,7 @@ namespace WixToolset.Core.ExtensibilityServices
558 } 548 }
559 549
560 // Check each part of the relative path to ensure that it is a valid directory name. 550 // Check each part of the relative path to ensure that it is a valid directory name.
561 for (int i = pathStartsAt; i < result.Length; ++i) 551 for (var i = pathStartsAt; i < result.Length; ++i)
562 { 552 {
563 if (!this.IsValidLongFilename(result[i], false, false)) 553 if (!this.IsValidLongFilename(result[i], false, false))
564 { 554 {
@@ -588,7 +578,7 @@ namespace WixToolset.Core.ExtensibilityServices
588 throw new ArgumentNullException("attribute"); 578 throw new ArgumentNullException("attribute");
589 } 579 }
590 580
591 string value = this.GetAttributeValue(sourceLineNumbers, attribute); 581 var value = this.GetAttributeValue(sourceLineNumbers, attribute);
592 582
593 if (0 < value.Length) 583 if (0 < value.Length)
594 { 584 {
@@ -605,7 +595,7 @@ namespace WixToolset.Core.ExtensibilityServices
605 } 595 }
606 else if (allowRelative) 596 else if (allowRelative)
607 { 597 {
608 string normalizedPath = value.Replace('\\', '/'); 598 var normalizedPath = value.Replace('\\', '/');
609 if (normalizedPath.StartsWith("../", StringComparison.Ordinal) || normalizedPath.Contains("/../")) 599 if (normalizedPath.StartsWith("../", StringComparison.Ordinal) || normalizedPath.Contains("/../"))
610 { 600 {
611 this.Messaging.Write(ErrorMessages.PayloadMustBeRelativeToCache(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value)); 601 this.Messaging.Write(ErrorMessages.PayloadMustBeRelativeToCache(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value));
@@ -624,13 +614,13 @@ namespace WixToolset.Core.ExtensibilityServices
624 { 614 {
625 Debug.Assert(minimum > CompilerConstants.LongNotSet && minimum > CompilerConstants.IllegalLong, "The legal values for this attribute collide with at least one sentinel used during parsing."); 615 Debug.Assert(minimum > CompilerConstants.LongNotSet && minimum > CompilerConstants.IllegalLong, "The legal values for this attribute collide with at least one sentinel used during parsing.");
626 616
627 string value = this.GetAttributeValue(sourceLineNumbers, attribute); 617 var value = this.GetAttributeValue(sourceLineNumbers, attribute);
628 618
629 if (0 < value.Length) 619 if (0 < value.Length)
630 { 620 {
631 try 621 try
632 { 622 {
633 long longValue = Convert.ToInt64(value, CultureInfo.InvariantCulture.NumberFormat); 623 var longValue = Convert.ToInt64(value, CultureInfo.InvariantCulture.NumberFormat);
634 624
635 if (CompilerConstants.LongNotSet == longValue || CompilerConstants.IllegalLong == longValue) 625 if (CompilerConstants.LongNotSet == longValue || CompilerConstants.IllegalLong == longValue)
636 { 626 {
@@ -664,7 +654,7 @@ namespace WixToolset.Core.ExtensibilityServices
664 654
665 public RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) 655 public RegistryRootType? GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu)
666 { 656 {
667 string value = this.GetAttributeValue(sourceLineNumbers, attribute); 657 var value = this.GetAttributeValue(sourceLineNumbers, attribute);
668 if (String.IsNullOrEmpty(value)) 658 if (String.IsNullOrEmpty(value))
669 { 659 {
670 return null; 660 return null;
@@ -814,8 +804,8 @@ namespace WixToolset.Core.ExtensibilityServices
814 } 804 }
815 805
816 // Check for a non-period character (all periods is not legal) 806 // Check for a non-period character (all periods is not legal)
817 bool nonPeriodFound = false; 807 var nonPeriodFound = false;
818 foreach (char character in filename) 808 foreach (var character in filename)
819 { 809 {
820 if ('.' != character) 810 if ('.' != character)
821 { 811 {
@@ -867,7 +857,6 @@ namespace WixToolset.Core.ExtensibilityServices
867 { 857 {
868 if (ParseHelper.TryFindExtension(extensions, element.Name.Namespace, out var extension)) 858 if (ParseHelper.TryFindExtension(extensions, element.Name.Namespace, out var extension))
869 { 859 {
870 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement);
871 extension.ParseElement(intermediate, section, parentElement, element, context); 860 extension.ParseElement(intermediate, section, parentElement, element, context);
872 } 861 }
873 else 862 else
@@ -896,7 +885,7 @@ namespace WixToolset.Core.ExtensibilityServices
896 885
897 public void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element) 886 public void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element)
898 { 887 {
899 foreach (XElement child in element.Elements()) 888 foreach (var child in element.Elements())
900 { 889 {
901 if (element.Name.Namespace == child.Name.Namespace) 890 if (element.Name.Namespace == child.Name.Namespace)
902 { 891 {
@@ -913,7 +902,7 @@ namespace WixToolset.Core.ExtensibilityServices
913 { 902 {
914 var actionId = new Identifier(access, sequence, actionName); 903 var actionId = new Identifier(access, sequence, actionName);
915 904
916 var actionTuple = new WixActionTuple(sourceLineNumbers, actionId) 905 var actionTuple = section.AddTuple(new WixActionTuple(sourceLineNumbers, actionId)
917 { 906 {
918 SequenceTable = sequence, 907 SequenceTable = sequence,
919 Action = actionName, 908 Action = actionName,
@@ -921,19 +910,17 @@ namespace WixToolset.Core.ExtensibilityServices
921 Before = beforeAction, 910 Before = beforeAction,
922 After = afterAction, 911 After = afterAction,
923 Overridable = overridable, 912 Overridable = overridable,
924 }; 913 });
925
926 section.Tuples.Add(actionTuple);
927 914
928 if (null != beforeAction) 915 if (null != beforeAction)
929 { 916 {
930 if (WindowsInstallerStandard.IsStandardAction(beforeAction)) 917 if (WindowsInstallerStandard.IsStandardAction(beforeAction))
931 { 918 {
932 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.WixAction), sequence.ToString(), beforeAction); 919 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), beforeAction);
933 } 920 }
934 else 921 else
935 { 922 {
936 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), beforeAction); 923 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, beforeAction);
937 } 924 }
938 } 925 }
939 926
@@ -941,11 +928,11 @@ namespace WixToolset.Core.ExtensibilityServices
941 { 928 {
942 if (WindowsInstallerStandard.IsStandardAction(afterAction)) 929 if (WindowsInstallerStandard.IsStandardAction(afterAction))
943 { 930 {
944 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.WixAction), sequence.ToString(), afterAction); 931 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.WixAction, sequence.ToString(), afterAction);
945 } 932 }
946 else 933 else
947 { 934 {
948 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), afterAction); 935 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, afterAction);
949 } 936 }
950 } 937 }
951 938
@@ -981,7 +968,7 @@ namespace WixToolset.Core.ExtensibilityServices
981 break; 968 break;
982 } 969 }
983 970
984 this.CreateSimpleReference(section, sourceLineNumbers, nameof(TupleDefinitionType.CustomAction), name + suffix); 971 this.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, name + suffix);
985 } 972 }
986 } 973 }
987 974
diff --git a/src/WixToolset.Core/Link/WixGroupingOrdering.cs b/src/WixToolset.Core/Link/WixGroupingOrdering.cs
index 563cd565..7e0030ca 100644
--- a/src/WixToolset.Core/Link/WixGroupingOrdering.cs
+++ b/src/WixToolset.Core/Link/WixGroupingOrdering.cs
@@ -171,15 +171,15 @@ namespace WixToolset.Core.Link
171 // does WiX (although they do, currently). We probably want to "upgrade" this to a new 171 // does WiX (although they do, currently). We probably want to "upgrade" this to a new
172 // table that includes a sequence number, and then change the code that uses ordered 172 // table that includes a sequence number, and then change the code that uses ordered
173 // groups to read from that table instead. 173 // groups to read from that table instead.
174 foreach (Item item in orderedItems) 174 foreach (var item in orderedItems)
175 { 175 {
176 var row = new WixGroupTuple(item.Row.SourceLineNumbers); 176 this.EntrySection.AddTuple(new WixGroupTuple(item.Row.SourceLineNumbers)
177 row.ParentId = parentId; 177 {
178 row.ParentType = (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), parentType); 178 ParentId = parentId,
179 row.ChildId = item.Id; 179 ParentType = (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), parentType),
180 row.ChildType = (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), item.Type); 180 ChildId = item.Id,
181 181 ChildType = (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), item.Type),
182 this.EntrySection.Tuples.Add(row); 182 });
183 } 183 }
184 } 184 }
185 185
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs
index bc4f5774..4c4c6063 100644
--- a/src/WixToolset.Core/Linker.cs
+++ b/src/WixToolset.Core/Linker.cs
@@ -211,9 +211,6 @@ namespace WixToolset.Core
211 // resolve the feature to feature connects 211 // resolve the feature to feature connects
212 this.ResolveFeatureToFeatureConnects(featuresToFeatures, find.Symbols); 212 this.ResolveFeatureToFeatureConnects(featuresToFeatures, find.Symbols);
213 213
214 // start generating OutputTables and OutputRows for all the sections in the output
215 var ensureTableRows = new List<IntermediateTuple>();
216
217 // Create the section to hold the linked content. 214 // Create the section to hold the linked content.
218 var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage); 215 var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type, find.EntrySection.Codepage);
219 216
@@ -239,7 +236,7 @@ namespace WixToolset.Core
239 case TupleDefinitionType.Class: 236 case TupleDefinitionType.Class:
240 if (SectionType.Product == resolvedSection.Type) 237 if (SectionType.Product == resolvedSection.Type)
241 { 238 {
242 this.ResolveFeatures(tuple, 2, 11, componentsToFeatures, multipleFeatureComponents); 239 this.ResolveFeatures(tuple, (int)ClassTupleFields.ComponentRef, (int)ClassTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
243 } 240 }
244 break; 241 break;
245 242
@@ -294,7 +291,7 @@ namespace WixToolset.Core
294 case TupleDefinitionType.Extension: 291 case TupleDefinitionType.Extension:
295 if (SectionType.Product == resolvedSection.Type) 292 if (SectionType.Product == resolvedSection.Type)
296 { 293 {
297 this.ResolveFeatures(tuple, 1, 4, componentsToFeatures, multipleFeatureComponents); 294 this.ResolveFeatures(tuple, (int)ExtensionTupleFields.ComponentRef, (int)ExtensionTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
298 } 295 }
299 break; 296 break;
300 297
@@ -311,35 +308,31 @@ namespace WixToolset.Core
311 case TupleDefinitionType.Assembly: 308 case TupleDefinitionType.Assembly:
312 if (SectionType.Product == resolvedSection.Type) 309 if (SectionType.Product == resolvedSection.Type)
313 { 310 {
314 this.ResolveFeatures(tuple, 0, 1, componentsToFeatures, multipleFeatureComponents); 311 this.ResolveFeatures(tuple, (int)AssemblyTupleFields.ComponentRef, (int)AssemblyTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
315 } 312 }
316 break; 313 break;
317 314
318 case TupleDefinitionType.PublishComponent: 315 case TupleDefinitionType.PublishComponent:
319 if (SectionType.Product == resolvedSection.Type) 316 if (SectionType.Product == resolvedSection.Type)
320 { 317 {
321 this.ResolveFeatures(tuple, 2, 4, componentsToFeatures, multipleFeatureComponents); 318 this.ResolveFeatures(tuple, (int)PublishComponentTupleFields.ComponentRef, (int)PublishComponentTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
322 } 319 }
323 break; 320 break;
324 321
325 case TupleDefinitionType.Shortcut: 322 case TupleDefinitionType.Shortcut:
326 if (SectionType.Product == resolvedSection.Type) 323 if (SectionType.Product == resolvedSection.Type)
327 { 324 {
328 this.ResolveFeatures(tuple, 3, 4, componentsToFeatures, multipleFeatureComponents); 325 this.ResolveFeatures(tuple, (int)ShortcutTupleFields.ComponentRef, (int)ShortcutTupleFields.Target, componentsToFeatures, multipleFeatureComponents);
329 } 326 }
330 break; 327 break;
331 328
332 case TupleDefinitionType.TypeLib: 329 case TupleDefinitionType.TypeLib:
333 if (SectionType.Product == resolvedSection.Type) 330 if (SectionType.Product == resolvedSection.Type)
334 { 331 {
335 this.ResolveFeatures(tuple, 2, 6, componentsToFeatures, multipleFeatureComponents); 332 this.ResolveFeatures(tuple, (int)TypeLibTupleFields.ComponentRef, (int)TypeLibTupleFields.FeatureRef, componentsToFeatures, multipleFeatureComponents);
336 } 333 }
337 break; 334 break;
338 335
339 case TupleDefinitionType.WixEnsureTable:
340 ensureTableRows.Add(tuple);
341 break;
342
343#if MOVE_TO_BACKEND 336#if MOVE_TO_BACKEND
344 case "WixFile": 337 case "WixFile":
345 foreach (Row row in table.Rows) 338 foreach (Row row in table.Rows)
@@ -404,7 +397,7 @@ namespace WixToolset.Core
404 397
405 if (copyTuple) 398 if (copyTuple)
406 { 399 {
407 resolvedSection.Tuples.Add(tuple); 400 resolvedSection.AddTuple(tuple);
408 } 401 }
409 } 402 }
410 } 403 }
@@ -414,13 +407,11 @@ namespace WixToolset.Core
414 { 407 {
415 foreach (var feature in connectToFeature.ConnectFeatures) 408 foreach (var feature in connectToFeature.ConnectFeatures)
416 { 409 {
417 var row = new WixFeatureModulesTuple 410 resolvedSection.AddTuple(new WixFeatureModulesTuple
418 { 411 {
419 FeatureRef = feature, 412 FeatureRef = feature,
420 WixMergeRef = connectToFeature.ChildId 413 WixMergeRef = connectToFeature.ChildId
421 }; 414 });
422
423 resolvedSection.Tuples.Add(row);
424 } 415 }
425 } 416 }
426 417
@@ -554,9 +545,9 @@ namespace WixToolset.Core
554#endif 545#endif
555 546
556 // copy the wix variable rows to the output after all overriding has been accounted for. 547 // copy the wix variable rows to the output after all overriding has been accounted for.
557 foreach (var row in wixVariables.Values) 548 foreach (var tuple in wixVariables.Values)
558 { 549 {
559 resolvedSection.Tuples.Add(row); 550 resolvedSection.AddTuple(tuple);
560 } 551 }
561 552
562 // Bundles have groups of data that must be flattened in a way different from other types. 553 // Bundles have groups of data that must be flattened in a way different from other types.
@@ -774,9 +765,8 @@ namespace WixToolset.Core
774 765
775 foreach (var section in sections) 766 foreach (var section in sections)
776 { 767 {
777 var featureComponents = new List<FeatureComponentsTuple>(); 768 // Need ToList since we might want to add tuples while processing.
778 769 foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>().ToList())
779 foreach (var wixComplexReferenceRow in section.Tuples.OfType<WixComplexReferenceTuple>())
780 { 770 {
781 ConnectToFeature connection; 771 ConnectToFeature connection;
782 switch (wixComplexReferenceRow.ParentType) 772 switch (wixComplexReferenceRow.ParentType)
@@ -810,11 +800,11 @@ namespace WixToolset.Core
810 } 800 }
811 801
812 // add a row to the FeatureComponents table 802 // add a row to the FeatureComponents table
813 var featureComponent = new FeatureComponentsTuple(); 803 section.AddTuple(new FeatureComponentsTuple
814 featureComponent.FeatureRef = wixComplexReferenceRow.Parent; 804 {
815 featureComponent.ComponentRef = wixComplexReferenceRow.Child; 805 FeatureRef = wixComplexReferenceRow.Parent,
816 806 ComponentRef = wixComplexReferenceRow.Child,
817 featureComponents.Add(featureComponent); 807 });
818 808
819 // index the component for finding orphaned records 809 // index the component for finding orphaned records
820 var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child); 810 var symbolName = String.Concat("Component:", wixComplexReferenceRow.Child);
@@ -878,10 +868,12 @@ namespace WixToolset.Core
878 componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new 868 componentsToModules.Add(wixComplexReferenceRow.Child, wixComplexReferenceRow); // should always be new
879 869
880 // add a row to the ModuleComponents table 870 // add a row to the ModuleComponents table
881 var moduleComponent = new ModuleComponentsTuple(); 871 section.AddTuple(new ModuleComponentsTuple
882 moduleComponent.Component = wixComplexReferenceRow.Child; 872 {
883 moduleComponent.ModuleID = wixComplexReferenceRow.Parent; 873 Component = wixComplexReferenceRow.Child,
884 moduleComponent.Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage); 874 ModuleID = wixComplexReferenceRow.Parent,
875 Language = Convert.ToInt32(wixComplexReferenceRow.ParentLanguage),
876 });
885 } 877 }
886 878
887 // index the component for finding orphaned records 879 // index the component for finding orphaned records
@@ -931,11 +923,6 @@ namespace WixToolset.Core
931 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType))); 923 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, "Unexpected complex reference child type: {0}", Enum.GetName(typeof(ComplexReferenceParentType), wixComplexReferenceRow.ParentType)));
932 } 924 }
933 } 925 }
934
935 foreach (var featureComponent in featureComponents)
936 {
937 section.Tuples.Add(featureComponent);
938 }
939 } 926 }
940 } 927 }
941 928
@@ -1048,7 +1035,7 @@ namespace WixToolset.Core
1048 (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) && 1035 (ComplexReferenceParentType.ComponentGroup != wixComplexReferenceRow.ParentType) &&
1049 (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType)) 1036 (ComplexReferenceParentType.PatchFamilyGroup != wixComplexReferenceRow.ParentType))
1050 { 1037 {
1051 section.Tuples.Add(wixComplexReferenceRow); 1038 section.AddTuple(wixComplexReferenceRow);
1052 } 1039 }
1053 } 1040 }
1054 } 1041 }
@@ -1322,15 +1309,15 @@ namespace WixToolset.Core
1322 /// <summary> 1309 /// <summary>
1323 /// Resolve features for columns that have null guid placeholders. 1310 /// Resolve features for columns that have null guid placeholders.
1324 /// </summary> 1311 /// </summary>
1325 /// <param name="rows">Rows to resolve.</param> 1312 /// <param name="tuple">Tuple to resolve.</param>
1326 /// <param name="connectionColumn">Number of the column containing the connection identifier.</param> 1313 /// <param name="connectionColumn">Number of the column containing the connection identifier.</param>
1327 /// <param name="featureColumn">Number of the column containing the feature.</param> 1314 /// <param name="featureColumn">Number of the column containing the feature.</param>
1328 /// <param name="connectToFeatures">Connect to feature complex references.</param> 1315 /// <param name="connectToFeatures">Connect to feature complex references.</param>
1329 /// <param name="multipleFeatureComponents">Hashtable of known components under multiple features.</param> 1316 /// <param name="multipleFeatureComponents">Hashtable of known components under multiple features.</param>
1330 private void ResolveFeatures(IntermediateTuple row, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents) 1317 private void ResolveFeatures(IntermediateTuple tuple, int connectionColumn, int featureColumn, ConnectToFeatureCollection connectToFeatures, Hashtable multipleFeatureComponents)
1331 { 1318 {
1332 var connectionId = row.AsString(connectionColumn); 1319 var connectionId = tuple.AsString(connectionColumn);
1333 var featureId = row.AsString(featureColumn); 1320 var featureId = tuple.AsString(featureColumn);
1334 1321
1335 if (EmptyGuid == featureId) 1322 if (EmptyGuid == featureId)
1336 { 1323 {
@@ -1338,14 +1325,14 @@ namespace WixToolset.Core
1338 1325
1339 if (null == connection) 1326 if (null == connection)
1340 { 1327 {
1341 // display an error for the component or merge module as approrpriate 1328 // display an error for the component or merge module as appropriate
1342 if (null != multipleFeatureComponents) 1329 if (null != multipleFeatureComponents)
1343 { 1330 {
1344 this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(row.SourceLineNumbers, connectionId, row.Definition.Name, row.Id.Id)); 1331 this.Messaging.Write(ErrorMessages.ComponentExpectedFeature(tuple.SourceLineNumbers, connectionId, tuple.Definition.Name, tuple.Id.Id));
1345 } 1332 }
1346 else 1333 else
1347 { 1334 {
1348 this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(row.SourceLineNumbers, connectionId)); 1335 this.Messaging.Write(ErrorMessages.MergeModuleExpectedFeature(tuple.SourceLineNumbers, connectionId));
1349 } 1336 }
1350 } 1337 }
1351 else 1338 else
@@ -1373,7 +1360,7 @@ namespace WixToolset.Core
1373 } 1360 }
1374 1361
1375 // set the feature 1362 // set the feature
1376 row.Set(featureColumn, connection.PrimaryFeature); 1363 tuple.Set(featureColumn, connection.PrimaryFeature);
1377 } 1364 }
1378 } 1365 }
1379 } 1366 }
diff --git a/src/test/Example.Extension/ExampleCompilerExtension.cs b/src/test/Example.Extension/ExampleCompilerExtension.cs
index 9f0abd4c..0005b1d5 100644
--- a/src/test/Example.Extension/ExampleCompilerExtension.cs
+++ b/src/test/Example.Extension/ExampleCompilerExtension.cs
@@ -157,10 +157,10 @@ namespace Example.Extension
157 157
158 if (!this.Messaging.EncounteredError) 158 if (!this.Messaging.EncounteredError)
159 { 159 {
160 160 var tuple = section.AddTuple(new ExampleSearchTuple(sourceLineNumbers, id)
161 var tuple = new ExampleSearchTuple(sourceLineNumbers, id); 161 {
162 section.Tuples.Add(tuple); 162 SearchFor = searchFor,
163 tuple.SearchFor = searchFor; 163 });
164 } 164 }
165 } 165 }
166 166
@@ -176,7 +176,7 @@ namespace Example.Extension
176 { 176 {
177 case "Id": 177 case "Id":
178 var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 178 var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
179 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ExampleSearch", refId); 179 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ExampleTupleDefinitions.ExampleSearch, refId);
180 break; 180 break;
181 default: 181 default:
182 this.ParseHelper.UnexpectedAttribute(element, attrib); 182 this.ParseHelper.UnexpectedAttribute(element, attrib);