aboutsummaryrefslogtreecommitdiff
path: root/src/wixext/IIsCompiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wixext/IIsCompiler.cs')
-rw-r--r--src/wixext/IIsCompiler.cs589
1 files changed, 327 insertions, 262 deletions
diff --git a/src/wixext/IIsCompiler.cs b/src/wixext/IIsCompiler.cs
index e28435b6..f84f8f0a 100644
--- a/src/wixext/IIsCompiler.cs
+++ b/src/wixext/IIsCompiler.cs
@@ -8,6 +8,7 @@ namespace WixToolset.Iis
8 using System.Xml.Linq; 8 using System.Xml.Linq;
9 using WixToolset.Data; 9 using WixToolset.Data;
10 using WixToolset.Extensibility; 10 using WixToolset.Extensibility;
11 using WixToolset.Iis.Tuples;
11 12
12 /// <summary> 13 /// <summary>
13 /// The compiler for the WiX Toolset Internet Information Services Extension. 14 /// The compiler for the WiX Toolset Internet Information Services Extension.
@@ -64,8 +65,8 @@ namespace WixToolset.Iis
64 switch (parentElement.Name.LocalName) 65 switch (parentElement.Name.LocalName)
65 { 66 {
66 case "Component": 67 case "Component":
67 string componentId = context["ComponentId"]; 68 var componentId = context["ComponentId"];
68 string directoryId = context["DirectoryId"]; 69 var directoryId = context["DirectoryId"];
69 70
70 switch (element.Name.LocalName) 71 switch (element.Name.LocalName)
71 { 72 {
@@ -110,7 +111,7 @@ namespace WixToolset.Iis
110 this.ParseWebAppPoolElement(intermediate, section, element, null); 111 this.ParseWebAppPoolElement(intermediate, section, element, null);
111 break; 112 break;
112 case "WebDirProperties": 113 case "WebDirProperties":
113 this.ParseWebDirPropertiesElement(intermediate, section, element); 114 this.ParseWebDirPropertiesElement(intermediate, section, element, null);
114 break; 115 break;
115 case "WebLog": 116 case "WebLog":
116 this.ParseWebLogElement(intermediate, section, element); 117 this.ParseWebLogElement(intermediate, section, element);
@@ -136,7 +137,7 @@ namespace WixToolset.Iis
136 /// <param name="componentId">Identifier for parent component.</param> 137 /// <param name="componentId">Identifier for parent component.</param>
137 private void ParseCertificateElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) 138 private void ParseCertificateElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
138 { 139 {
139 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 140 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
140 Identifier id = null; 141 Identifier id = null;
141 int attributes = 0; 142 int attributes = 0;
142 string binaryKey = null; 143 string binaryKey = null;
@@ -146,7 +147,7 @@ namespace WixToolset.Iis
146 int storeLocation = 0; 147 int storeLocation = 0;
147 string storeName = null; 148 string storeName = null;
148 149
149 foreach (XAttribute attrib in element.Attributes()) 150 foreach (var attrib in element.Attributes())
150 { 151 {
151 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 152 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
152 { 153 {
@@ -158,7 +159,7 @@ namespace WixToolset.Iis
158 case "BinaryKey": 159 case "BinaryKey":
159 attributes |= 2; // SCA_CERT_ATTRIBUTE_BINARYDATA 160 attributes |= 2; // SCA_CERT_ATTRIBUTE_BINARYDATA
160 binaryKey = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 161 binaryKey = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
161 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Binary", binaryKey); 162 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Binary, binaryKey);
162 break; 163 break;
163 case "CertificatePath": 164 case "CertificatePath":
164 certificatePath = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 165 certificatePath = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
@@ -190,7 +191,7 @@ namespace WixToolset.Iis
190 } 191 }
191 break; 192 break;
192 case "StoreLocation": 193 case "StoreLocation":
193 string storeLocationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 194 var storeLocationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
194 if (0 < storeLocationValue.Length) 195 if (0 < storeLocationValue.Length)
195 { 196 {
196 switch (storeLocationValue) 197 switch (storeLocationValue)
@@ -209,7 +210,7 @@ namespace WixToolset.Iis
209 } 210 }
210 break; 211 break;
211 case "StoreName": 212 case "StoreName":
212 string storeNameValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 213 var storeNameValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
213 if (0 < storeNameValue.Length) 214 if (0 < storeNameValue.Length)
214 { 215 {
215 switch (storeNameValue) 216 switch (storeNameValue)
@@ -256,7 +257,7 @@ namespace WixToolset.Iis
256 257
257 if (null == id) 258 if (null == id)
258 { 259 {
259 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 260 id = this.ParseHelper.CreateIdentifier("crt", componentId, binaryKey, certificatePath);
260 } 261 }
261 262
262 if (null == name) 263 if (null == name)
@@ -286,21 +287,23 @@ namespace WixToolset.Iis
286 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 287 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
287 288
288 // Reference InstallCertificates and UninstallCertificates since nothing will happen without them 289 // Reference InstallCertificates and UninstallCertificates since nothing will happen without them
289 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallCertificates"); 290 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "InstallCertificates");
290 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallCertificates"); 291 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "UninstallCertificates");
291 this.ParseHelper.EnsureTable(section, sourceLineNumbers, "CertificateHash"); // Certificate CustomActions require the CertificateHash table 292 this.ParseHelper.EnsureTable(section, sourceLineNumbers, IisTableDefinitions.CertificateHash); // Certificate CustomActions require the CertificateHash table
292 293
293 if (!this.Messaging.EncounteredError) 294 if (!this.Messaging.EncounteredError)
294 { 295 {
295 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Certificate", id); 296 section.AddTuple(new CertificateTuple(sourceLineNumbers, id)
296 row.Set(1, componentId); 297 {
297 row.Set(2, name); 298 ComponentRef = componentId,
298 row.Set(3, storeLocation); 299 Name = name,
299 row.Set(4, storeName); 300 StoreLocation = storeLocation,
300 row.Set(5, attributes); 301 StoreName = storeName,
301 row.Set(6, binaryKey); 302 Attributes = attributes,
302 row.Set(7, certificatePath); 303 BinaryRef = binaryKey,
303 row.Set(8, pfxPassword); 304 CertificatePath = certificatePath,
305 PFXPassword = pfxPassword,
306 });
304 } 307 }
305 } 308 }
306 309
@@ -311,10 +314,10 @@ namespace WixToolset.Iis
311 /// <param name="webId">Identifier for parent web site.</param> 314 /// <param name="webId">Identifier for parent web site.</param>
312 private void ParseCertificateRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string webId) 315 private void ParseCertificateRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string webId)
313 { 316 {
314 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 317 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
315 Identifier id = null; 318 Identifier id = null;
316 319
317 foreach (XAttribute attrib in element.Attributes()) 320 foreach (var attrib in element.Attributes())
318 { 321 {
319 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 322 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
320 { 323 {
@@ -322,7 +325,7 @@ namespace WixToolset.Iis
322 { 325 {
323 case "Id": 326 case "Id":
324 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); 327 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
325 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Certificate", id.Id); 328 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.Certificate, id.Id);
326 break; 329 break;
327 default: 330 default:
328 this.ParseHelper.UnexpectedAttribute(element, attrib); 331 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -337,18 +340,20 @@ namespace WixToolset.Iis
337 340
338 if (null == id) 341 if (null == id)
339 { 342 {
340 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 343 id = this.ParseHelper.CreateIdentifier("wsc", webId);
341 } 344 }
342 345
343 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 346 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
344 347
345 if (!this.Messaging.EncounteredError) 348 if (!this.Messaging.EncounteredError)
346 { 349 {
347 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Certificate", id.Id); 350 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.Certificate, id.Id);
348 351
349 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebSiteCertificates"); 352 section.AddTuple(new IIsWebSiteCertificatesTuple(sourceLineNumbers)
350 row.Set(0, webId); 353 {
351 row.Set(1, id.Id); 354 WebRef = webId,
355 CertificateRef = id.Id,
356 });
352 } 357 }
353 } 358 }
354 359
@@ -360,12 +365,12 @@ namespace WixToolset.Iis
360 /// <param name="parentType">Type that parentId refers to.</param> 365 /// <param name="parentType">Type that parentId refers to.</param>
361 private void ParseMimeMapElement(Intermediate intermediate, IntermediateSection section, XElement element, string parentId, MimeMapParentType parentType) 366 private void ParseMimeMapElement(Intermediate intermediate, IntermediateSection section, XElement element, string parentId, MimeMapParentType parentType)
362 { 367 {
363 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 368 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
364 Identifier id = null; 369 Identifier id = null;
365 string extension = null; 370 string extension = null;
366 string type = null; 371 string type = null;
367 372
368 foreach (XAttribute attrib in element.Attributes()) 373 foreach (var attrib in element.Attributes())
369 { 374 {
370 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 375 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
371 { 376 {
@@ -393,7 +398,7 @@ namespace WixToolset.Iis
393 398
394 if (null == id) 399 if (null == id)
395 { 400 {
396 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 401 id = this.ParseHelper.CreateIdentifier("imm", parentId, type, extension);
397 } 402 }
398 403
399 if (null == extension) 404 if (null == extension)
@@ -417,11 +422,13 @@ namespace WixToolset.Iis
417 422
418 if (!this.Messaging.EncounteredError) 423 if (!this.Messaging.EncounteredError)
419 { 424 {
420 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsMimeMap", id); 425 section.AddTuple(new IIsMimeMapTuple(sourceLineNumbers, id)
421 row.Set(1, (int)parentType); 426 {
422 row.Set(2, parentId); 427 ParentType = (int)parentType,
423 row.Set(3, type); 428 ParentValue = parentId,
424 row.Set(4, extension); 429 MimeType = type,
430 Extension = extension,
431 });
425 } 432 }
426 } 433 }
427 434
@@ -432,10 +439,10 @@ namespace WixToolset.Iis
432 /// <returns>Recycle time value.</returns> 439 /// <returns>Recycle time value.</returns>
433 private string ParseRecycleTimeElement(Intermediate intermediate, IntermediateSection section, XElement element) 440 private string ParseRecycleTimeElement(Intermediate intermediate, IntermediateSection section, XElement element)
434 { 441 {
435 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 442 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
436 string value = null; 443 string value = null;
437 444
438 foreach (XAttribute attrib in element.Attributes()) 445 foreach (var attrib in element.Attributes())
439 { 446 {
440 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 447 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
441 { 448 {
@@ -473,14 +480,14 @@ namespace WixToolset.Iis
473 /// <returns>Identifier for web address.</returns> 480 /// <returns>Identifier for web address.</returns>
474 private string ParseWebAddressElement(Intermediate intermediate, IntermediateSection section, XElement element, string parentWeb) 481 private string ParseWebAddressElement(Intermediate intermediate, IntermediateSection section, XElement element, string parentWeb)
475 { 482 {
476 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 483 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
477 Identifier id = null; 484 Identifier id = null;
478 string header = null; 485 string header = null;
479 string ip = null; 486 string ip = null;
480 string port = null; 487 string port = null;
481 bool secure = false; 488 var secure = false;
482 489
483 foreach (XAttribute attrib in element.Attributes()) 490 foreach (var attrib in element.Attributes())
484 { 491 {
485 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 492 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
486 { 493 {
@@ -514,7 +521,7 @@ namespace WixToolset.Iis
514 521
515 if (null == id) 522 if (null == id)
516 { 523 {
517 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 524 id = this.ParseHelper.CreateIdentifier("iwa", parentWeb, ip, port);
518 } 525 }
519 526
520 if (null == port) 527 if (null == port)
@@ -526,12 +533,14 @@ namespace WixToolset.Iis
526 533
527 if (!this.Messaging.EncounteredError) 534 if (!this.Messaging.EncounteredError)
528 { 535 {
529 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebAddress", id); 536 section.AddTuple(new IIsWebAddressTuple(sourceLineNumbers, id)
530 row.Set(1, parentWeb); 537 {
531 row.Set(2, ip); 538 WebRef = parentWeb,
532 row.Set(3, port); 539 IP = ip,
533 row.Set(4, header); 540 Port = port,
534 row.Set(5, secure ? 1 : 0); 541 Header = header,
542 Secure = secure ? 1 : 0,
543 });
535 } 544 }
536 545
537 return id?.Id; 546 return id?.Id;
@@ -544,21 +553,21 @@ namespace WixToolset.Iis
544 /// <returns>Identifier for web application.</returns> 553 /// <returns>Identifier for web application.</returns>
545 private string ParseWebApplicationElement(Intermediate intermediate, IntermediateSection section, XElement element) 554 private string ParseWebApplicationElement(Intermediate intermediate, IntermediateSection section, XElement element)
546 { 555 {
547 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 556 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
548 Identifier id = null; 557 Identifier id = null;
549 YesNoDefaultType allowSessions = YesNoDefaultType.Default; 558 var allowSessions = YesNoDefaultType.Default;
550 string appPool = null; 559 string appPool = null;
551 YesNoDefaultType buffer = YesNoDefaultType.Default; 560 var buffer = YesNoDefaultType.Default;
552 YesNoDefaultType clientDebugging = YesNoDefaultType.Default; 561 var clientDebugging = YesNoDefaultType.Default;
553 string defaultScript = null; 562 string defaultScript = null;
554 int isolation = 0; 563 int isolation = 0;
555 string name = null; 564 string name = null;
556 YesNoDefaultType parentPaths = YesNoDefaultType.Default; 565 var parentPaths = YesNoDefaultType.Default;
557 int scriptTimeout = CompilerConstants.IntegerNotSet; 566 var scriptTimeout = CompilerConstants.IntegerNotSet;
558 int sessionTimeout = CompilerConstants.IntegerNotSet; 567 var sessionTimeout = CompilerConstants.IntegerNotSet;
559 YesNoDefaultType serverDebugging = YesNoDefaultType.Default; 568 var serverDebugging = YesNoDefaultType.Default;
560 569
561 foreach (XAttribute attrib in element.Attributes()) 570 foreach (var attrib in element.Attributes())
562 { 571 {
563 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 572 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
564 { 573 {
@@ -630,7 +639,7 @@ namespace WixToolset.Iis
630 break; 639 break;
631 case "WebAppPool": 640 case "WebAppPool":
632 appPool = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 641 appPool = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
633 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsAppPool", appPool); 642 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsAppPool, appPool);
634 break; 643 break;
635 default: 644 default:
636 this.ParseHelper.UnexpectedAttribute(element, attrib); 645 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -645,7 +654,7 @@ namespace WixToolset.Iis
645 654
646 if (null == id) 655 if (null == id)
647 { 656 {
648 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 657 id = this.ParseHelper.CreateIdentifier("wap", name, appPool);
649 } 658 }
650 659
651 if (null == name) 660 if (null == name)
@@ -657,11 +666,10 @@ namespace WixToolset.Iis
657 this.Messaging.Write(IIsErrors.IllegalCharacterInAttributeValue(sourceLineNumbers, element.Name.LocalName, "Name", name, '\\')); 666 this.Messaging.Write(IIsErrors.IllegalCharacterInAttributeValue(sourceLineNumbers, element.Name.LocalName, "Name", name, '\\'));
658 } 667 }
659 668
660 foreach (XElement child in element.Elements()) 669 foreach (var child in element.Elements())
661 { 670 {
662 if (this.Namespace == child.Name.Namespace) 671 if (this.Namespace == child.Name.Namespace)
663 { 672 {
664 SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
665 switch (child.Name.LocalName) 673 switch (child.Name.LocalName)
666 { 674 {
667 case "WebApplicationExtension": 675 case "WebApplicationExtension":
@@ -680,44 +688,48 @@ namespace WixToolset.Iis
680 688
681 if (!this.Messaging.EncounteredError) 689 if (!this.Messaging.EncounteredError)
682 { 690 {
683 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebApplication", id); 691 var tuple = section.AddTuple(new IIsWebApplicationTuple(sourceLineNumbers, id)
684 row.Set(1, name); 692 {
685 row.Set(2, isolation); 693 Name = name,
694 Isolation = isolation,
695 DefaultScript = defaultScript,
696 AppPoolRef = appPool,
697 });
698
686 if (YesNoDefaultType.Default != allowSessions) 699 if (YesNoDefaultType.Default != allowSessions)
687 { 700 {
688 row.Set(3, YesNoDefaultType.Yes == allowSessions ? 1 : 0); 701 tuple.AllowSessions = YesNoDefaultType.Yes == allowSessions ? 1 : 0;
689 } 702 }
690 703
691 if (CompilerConstants.IntegerNotSet != sessionTimeout) 704 if (CompilerConstants.IntegerNotSet != sessionTimeout)
692 { 705 {
693 row.Set(4, sessionTimeout); 706 tuple.SessionTimeout = sessionTimeout;
694 } 707 }
695 708
696 if (YesNoDefaultType.Default != buffer) 709 if (YesNoDefaultType.Default != buffer)
697 { 710 {
698 row.Set(5, YesNoDefaultType.Yes == buffer ? 1 : 0); 711 tuple.Buffer = YesNoDefaultType.Yes == buffer ? 1 : 0;
699 } 712 }
700 713
701 if (YesNoDefaultType.Default != parentPaths) 714 if (YesNoDefaultType.Default != parentPaths)
702 { 715 {
703 row.Set(6, YesNoDefaultType.Yes == parentPaths ? 1 : 0); 716 tuple.ParentPaths = YesNoDefaultType.Yes == parentPaths ? 1 : 0;
704 } 717 }
705 row.Set(7, defaultScript); 718
706 if (CompilerConstants.IntegerNotSet != scriptTimeout) 719 if (CompilerConstants.IntegerNotSet != scriptTimeout)
707 { 720 {
708 row.Set(8, scriptTimeout); 721 tuple.ScriptTimeout = scriptTimeout;
709 } 722 }
710 723
711 if (YesNoDefaultType.Default != serverDebugging) 724 if (YesNoDefaultType.Default != serverDebugging)
712 { 725 {
713 row.Set(9, YesNoDefaultType.Yes == serverDebugging ? 1 : 0); 726 tuple.ServerDebugging = YesNoDefaultType.Yes == serverDebugging ? 1 : 0;
714 } 727 }
715 728
716 if (YesNoDefaultType.Default != clientDebugging) 729 if (YesNoDefaultType.Default != clientDebugging)
717 { 730 {
718 row.Set(10, YesNoDefaultType.Yes == clientDebugging ? 1 : 0); 731 tuple.ClientDebugging = YesNoDefaultType.Yes == clientDebugging ? 1 : 0;
719 } 732 }
720 row.Set(11, appPool);
721 } 733 }
722 734
723 return id?.Id; 735 return id?.Id;
@@ -730,13 +742,13 @@ namespace WixToolset.Iis
730 /// <param name="application">Identifier for parent web application.</param> 742 /// <param name="application">Identifier for parent web application.</param>
731 private void ParseWebApplicationExtensionElement(Intermediate intermediate, IntermediateSection section, XElement element, string application) 743 private void ParseWebApplicationExtensionElement(Intermediate intermediate, IntermediateSection section, XElement element, string application)
732 { 744 {
733 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 745 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
734 int attributes = 0; 746 int attributes = 0;
735 string executable = null; 747 string executable = null;
736 string extension = null; 748 string extension = null;
737 string verbs = null; 749 string verbs = null;
738 750
739 foreach (XAttribute attrib in element.Attributes()) 751 foreach (var attrib in element.Attributes())
740 { 752 {
741 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 753 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
742 { 754 {
@@ -786,14 +798,17 @@ namespace WixToolset.Iis
786 798
787 if (!this.Messaging.EncounteredError) 799 if (!this.Messaging.EncounteredError)
788 { 800 {
789 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebApplicationExtension"); 801 var tuple = section.AddTuple(new IIsWebApplicationExtensionTuple(sourceLineNumbers)
790 row.Set(0, application); 802 {
791 row.Set(1, extension); 803 ApplicationRef = application,
792 row.Set(2, verbs); 804 Extension = extension,
793 row.Set(3, executable); 805 Verbs = verbs,
806 Executable = executable,
807 });
808
794 if (0 < attributes) 809 if (0 < attributes)
795 { 810 {
796 row.Set(4, attributes); 811 tuple.Attributes = attributes;
797 } 812 }
798 } 813 }
799 } 814 }
@@ -805,27 +820,27 @@ namespace WixToolset.Iis
805 /// <param name="componentId">Optional identifier of parent component.</param> 820 /// <param name="componentId">Optional identifier of parent component.</param>
806 private void ParseWebAppPoolElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) 821 private void ParseWebAppPoolElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
807 { 822 {
808 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 823 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
809 Identifier id = null; 824 Identifier id = null;
810 int attributes = 0; 825 int attributes = 0;
811 int cpuAction = CompilerConstants.IntegerNotSet; 826 var cpuAction = CompilerConstants.IntegerNotSet;
812 string cpuMon = null; 827 string cpuMon = null;
813 int idleTimeout = CompilerConstants.IntegerNotSet; 828 var idleTimeout = CompilerConstants.IntegerNotSet;
814 int maxCpuUsage = 0; 829 int maxCpuUsage = 0;
815 int maxWorkerProcs = CompilerConstants.IntegerNotSet; 830 var maxWorkerProcs = CompilerConstants.IntegerNotSet;
816 string managedRuntimeVersion = null; 831 string managedRuntimeVersion = null;
817 string managedPipelineMode = null; 832 string managedPipelineMode = null;
818 string name = null; 833 string name = null;
819 int privateMemory = CompilerConstants.IntegerNotSet; 834 var privateMemory = CompilerConstants.IntegerNotSet;
820 int queueLimit = CompilerConstants.IntegerNotSet; 835 var queueLimit = CompilerConstants.IntegerNotSet;
821 int recycleMinutes = CompilerConstants.IntegerNotSet; 836 var recycleMinutes = CompilerConstants.IntegerNotSet;
822 int recycleRequests = CompilerConstants.IntegerNotSet; 837 var recycleRequests = CompilerConstants.IntegerNotSet;
823 string recycleTimes = null; 838 string recycleTimes = null;
824 int refreshCpu = CompilerConstants.IntegerNotSet; 839 var refreshCpu = CompilerConstants.IntegerNotSet;
825 string user = null; 840 string user = null;
826 int virtualMemory = CompilerConstants.IntegerNotSet; 841 var virtualMemory = CompilerConstants.IntegerNotSet;
827 842
828 foreach (XAttribute attrib in element.Attributes()) 843 foreach (var attrib in element.Attributes())
829 { 844 {
830 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 845 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
831 { 846 {
@@ -840,7 +855,7 @@ namespace WixToolset.Iis
840 this.Messaging.Write(IIsErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); 855 this.Messaging.Write(IIsErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
841 } 856 }
842 857
843 string cpuActionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 858 var cpuActionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
844 if (0 < cpuActionValue.Length) 859 if (0 < cpuActionValue.Length)
845 { 860 {
846 switch (cpuActionValue) 861 switch (cpuActionValue)
@@ -863,7 +878,7 @@ namespace WixToolset.Iis
863 this.Messaging.Write(IIsErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); 878 this.Messaging.Write(IIsErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
864 } 879 }
865 880
866 string identityValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 881 var identityValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
867 if (0 < identityValue.Length) 882 if (0 < identityValue.Length)
868 { 883 {
869 switch (identityValue) 884 switch (identityValue)
@@ -1029,7 +1044,7 @@ namespace WixToolset.Iis
1029 1044
1030 if (null == id) 1045 if (null == id)
1031 { 1046 {
1032 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 1047 id = this.ParseHelper.CreateIdentifier("iap", name, componentId, user);
1033 } 1048 }
1034 1049
1035 if (null == name) 1050 if (null == name)
@@ -1057,7 +1072,7 @@ namespace WixToolset.Iis
1057 } 1072 }
1058 } 1073 }
1059 1074
1060 foreach (XElement child in element.Elements()) 1075 foreach (var child in element.Elements())
1061 { 1076 {
1062 if (this.Namespace == child.Name.Namespace) 1077 if (this.Namespace == child.Name.Namespace)
1063 { 1078 {
@@ -1066,7 +1081,7 @@ namespace WixToolset.Iis
1066 case "RecycleTime": 1081 case "RecycleTime":
1067 if (null == componentId) 1082 if (null == componentId)
1068 { 1083 {
1069 SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); 1084 var childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
1070 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, element.Name.LocalName)); 1085 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, element.Name.LocalName));
1071 } 1086 }
1072 1087
@@ -1093,52 +1108,57 @@ namespace WixToolset.Iis
1093 if (null != componentId) 1108 if (null != componentId)
1094 { 1109 {
1095 // Reference ConfigureIIs since nothing will happen without it 1110 // Reference ConfigureIIs since nothing will happen without it
1096 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 1111 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1097 } 1112 }
1098 1113
1099 if (!this.Messaging.EncounteredError) 1114 if (!this.Messaging.EncounteredError)
1100 { 1115 {
1101 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsAppPool", id); 1116 var tuple = section.AddTuple(new IIsAppPoolTuple(sourceLineNumbers, id)
1102 row.Set(1, name); 1117 {
1103 row.Set(2, componentId); 1118 Name = name,
1104 row.Set(3, attributes); 1119 ComponentRef = componentId,
1105 row.Set(4, user); 1120 Attributes = attributes,
1121 UserRef = user,
1122 RecycleTimes = recycleTimes,
1123 CPUMon = cpuMon,
1124 ManagedRuntimeVersion = managedRuntimeVersion,
1125 ManagedPipelineMode = managedPipelineMode,
1126 });
1127
1106 if (CompilerConstants.IntegerNotSet != recycleMinutes) 1128 if (CompilerConstants.IntegerNotSet != recycleMinutes)
1107 { 1129 {
1108 row.Set(5, recycleMinutes); 1130 tuple.RecycleMinutes = recycleMinutes;
1109 } 1131 }
1110 1132
1111 if (CompilerConstants.IntegerNotSet != recycleRequests) 1133 if (CompilerConstants.IntegerNotSet != recycleRequests)
1112 { 1134 {
1113 row.Set(6, recycleRequests); 1135 tuple.RecycleRequests = recycleRequests;
1114 } 1136 }
1115 row.Set(7, recycleTimes); 1137
1116 if (CompilerConstants.IntegerNotSet != idleTimeout) 1138 if (CompilerConstants.IntegerNotSet != idleTimeout)
1117 { 1139 {
1118 row.Set(8, idleTimeout); 1140 tuple.IdleTimeout = idleTimeout;
1119 } 1141 }
1120 1142
1121 if (CompilerConstants.IntegerNotSet != queueLimit) 1143 if (CompilerConstants.IntegerNotSet != queueLimit)
1122 { 1144 {
1123 row.Set(9, queueLimit); 1145 tuple.QueueLimit = queueLimit;
1124 } 1146 }
1125 row.Set(10, cpuMon); 1147
1126 if (CompilerConstants.IntegerNotSet != maxWorkerProcs) 1148 if (CompilerConstants.IntegerNotSet != maxWorkerProcs)
1127 { 1149 {
1128 row.Set(11, maxWorkerProcs); 1150 tuple.MaxProc = maxWorkerProcs;
1129 } 1151 }
1130 1152
1131 if (CompilerConstants.IntegerNotSet != virtualMemory) 1153 if (CompilerConstants.IntegerNotSet != virtualMemory)
1132 { 1154 {
1133 row.Set(12, virtualMemory); 1155 tuple.VirtualMemory = virtualMemory;
1134 } 1156 }
1135 1157
1136 if (CompilerConstants.IntegerNotSet != privateMemory) 1158 if (CompilerConstants.IntegerNotSet != privateMemory)
1137 { 1159 {
1138 row.Set(13, privateMemory); 1160 tuple.PrivateMemory = privateMemory;
1139 } 1161 }
1140 row.Set(14, managedRuntimeVersion);
1141 row.Set(15, managedPipelineMode);
1142 } 1162 }
1143 } 1163 }
1144 1164
@@ -1150,13 +1170,13 @@ namespace WixToolset.Iis
1150 /// <param name="parentWeb">Optional identifier for parent web site.</param> 1170 /// <param name="parentWeb">Optional identifier for parent web site.</param>
1151 private void ParseWebDirElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb) 1171 private void ParseWebDirElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb)
1152 { 1172 {
1153 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1173 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1154 Identifier id = null; 1174 Identifier id = null;
1155 string dirProperties = null; 1175 string dirProperties = null;
1156 string path = null; 1176 string path = null;
1157 string application = null; 1177 string application = null;
1158 1178
1159 foreach (XAttribute attrib in element.Attributes()) 1179 foreach (var attrib in element.Attributes())
1160 { 1180 {
1161 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1181 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1162 { 1182 {
@@ -1181,7 +1201,7 @@ namespace WixToolset.Iis
1181 } 1201 }
1182 1202
1183 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1203 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1184 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebSite", parentWeb); 1204 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebSite, parentWeb);
1185 break; 1205 break;
1186 default: 1206 default:
1187 this.ParseHelper.UnexpectedAttribute(element, attrib); 1207 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -1196,7 +1216,7 @@ namespace WixToolset.Iis
1196 1216
1197 if (null == id) 1217 if (null == id)
1198 { 1218 {
1199 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 1219 id = this.ParseHelper.CreateIdentifier("iwd", componentId, parentWeb, dirProperties, application);
1200 } 1220 }
1201 1221
1202 if (null == path) 1222 if (null == path)
@@ -1209,11 +1229,11 @@ namespace WixToolset.Iis
1209 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "WebSite")); 1229 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "WebSite"));
1210 } 1230 }
1211 1231
1212 foreach (XElement child in element.Elements()) 1232 foreach (var child in element.Elements())
1213 { 1233 {
1214 if (this.Namespace == child.Name.Namespace) 1234 if (this.Namespace == child.Name.Namespace)
1215 { 1235 {
1216 SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); 1236 var childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
1217 switch (child.Name.LocalName) 1237 switch (child.Name.LocalName)
1218 { 1238 {
1219 case "WebApplication": 1239 case "WebApplication":
@@ -1230,7 +1250,7 @@ namespace WixToolset.Iis
1230 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); 1250 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
1231 } 1251 }
1232 1252
1233 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child); 1253 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child, componentId);
1234 if (null == dirProperties) 1254 if (null == dirProperties)
1235 { 1255 {
1236 dirProperties = childWebDirProperties; 1256 dirProperties = childWebDirProperties;
@@ -1258,22 +1278,24 @@ namespace WixToolset.Iis
1258 1278
1259 if (null != application) 1279 if (null != application)
1260 { 1280 {
1261 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebApplication", application); 1281 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebApplication, application);
1262 } 1282 }
1263 1283
1264 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebDirProperties", dirProperties); 1284 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebDirProperties, dirProperties);
1265 1285
1266 // Reference ConfigureIIs since nothing will happen without it 1286 // Reference ConfigureIIs since nothing will happen without it
1267 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 1287 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1268 1288
1269 if (!this.Messaging.EncounteredError) 1289 if (!this.Messaging.EncounteredError)
1270 { 1290 {
1271 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebDir", id); 1291 section.AddTuple(new IIsWebDirTuple(sourceLineNumbers, id)
1272 row.Set(1, componentId); 1292 {
1273 row.Set(2, parentWeb); 1293 ComponentRef = componentId,
1274 row.Set(3, path); 1294 WebRef = parentWeb,
1275 row.Set(4, dirProperties); 1295 Path = path,
1276 row.Set(5, application); 1296 DirPropertiesRef = dirProperties,
1297 ApplicationRef = application,
1298 });
1277 } 1299 }
1278 } 1300 }
1279 1301
@@ -1282,29 +1304,29 @@ namespace WixToolset.Iis
1282 /// </summary> 1304 /// </summary>
1283 /// <param name="element">Element to parse.</param> 1305 /// <param name="element">Element to parse.</param>
1284 /// <returns>The identifier for this WebDirProperties.</returns> 1306 /// <returns>The identifier for this WebDirProperties.</returns>
1285 private string ParseWebDirPropertiesElement(Intermediate intermediate, IntermediateSection section, XElement element) 1307 private string ParseWebDirPropertiesElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
1286 { 1308 {
1287 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1309 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1288 Identifier id = null; 1310 Identifier id = null;
1289 int access = 0; 1311 int access = 0;
1290 bool accessSet = false; 1312 var accessSet = false;
1291 int accessSSLFlags = 0; 1313 int accessSSLFlags = 0;
1292 bool accessSSLFlagsSet = false; 1314 var accessSSLFlagsSet = false;
1293 string anonymousUser = null; 1315 string anonymousUser = null;
1294 YesNoType aspDetailedError = YesNoType.NotSet; 1316 var aspDetailedError = YesNoType.NotSet;
1295 string authenticationProviders = null; 1317 string authenticationProviders = null;
1296 int authorization = 0; 1318 int authorization = 0;
1297 bool authorizationSet = false; 1319 var authorizationSet = false;
1298 string cacheControlCustom = null; 1320 string cacheControlCustom = null;
1299 long cacheControlMaxAge = CompilerConstants.LongNotSet; 1321 var cacheControlMaxAge = CompilerConstants.LongNotSet;
1300 string defaultDocuments = null; 1322 string defaultDocuments = null;
1301 string httpExpires = null; 1323 string httpExpires = null;
1302 bool iisControlledPassword = false; 1324 var iisControlledPassword = false;
1303 YesNoType index = YesNoType.NotSet; 1325 var index = YesNoType.NotSet;
1304 YesNoType logVisits = YesNoType.NotSet; 1326 var logVisits = YesNoType.NotSet;
1305 YesNoType notCustomError = YesNoType.NotSet; 1327 var notCustomError = YesNoType.NotSet;
1306 1328
1307 foreach (XAttribute attrib in element.Attributes()) 1329 foreach (var attrib in element.Attributes())
1308 { 1330 {
1309 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1331 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1310 { 1332 {
@@ -1520,58 +1542,73 @@ namespace WixToolset.Iis
1520 1542
1521 if (null == id) 1543 if (null == id)
1522 { 1544 {
1523 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 1545 if (null == componentId)
1546 {
1547 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
1548 id = Identifier.Invalid;
1549 }
1550 else
1551 {
1552 id = this.ParseHelper.CreateIdentifier("wdp", componentId);
1553 }
1524 } 1554 }
1525 1555
1526 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 1556 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1527 1557
1528 if (!this.Messaging.EncounteredError) 1558 if (!this.Messaging.EncounteredError)
1529 { 1559 {
1530 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebDirProperties", id); 1560 var tuple = section.AddTuple(new IIsWebDirPropertiesTuple(sourceLineNumbers, id)
1561 {
1562 AnonymousUserRef = anonymousUser,
1563 IIsControlledPassword = iisControlledPassword ? 1 : 0,
1564 DefaultDoc = defaultDocuments,
1565 HttpExpires = httpExpires,
1566 CacheControlCustom = cacheControlCustom,
1567 });
1568
1531 if (accessSet) 1569 if (accessSet)
1532 { 1570 {
1533 row.Set(1, access); 1571 tuple.Access = access;
1534 } 1572 }
1535 1573
1536 if (authorizationSet) 1574 if (authorizationSet)
1537 { 1575 {
1538 row.Set(2, authorization); 1576 tuple.Authorization = authorization;
1539 } 1577 }
1540 row.Set(3, anonymousUser); 1578
1541 row.Set(4, iisControlledPassword ? 1 : 0);
1542 if (YesNoType.NotSet != logVisits) 1579 if (YesNoType.NotSet != logVisits)
1543 { 1580 {
1544 row.Set(5, YesNoType.Yes == logVisits ? 1 : 0); 1581 tuple.LogVisits = YesNoType.Yes == logVisits ? 1 : 0;
1545 } 1582 }
1546 1583
1547 if (YesNoType.NotSet != index) 1584 if (YesNoType.NotSet != index)
1548 { 1585 {
1549 row.Set(6, YesNoType.Yes == index ? 1 : 0); 1586 tuple.Index = YesNoType.Yes == index ? 1 : 0;
1550 } 1587 }
1551 row.Set(7, defaultDocuments); 1588
1552 if (YesNoType.NotSet != aspDetailedError) 1589 if (YesNoType.NotSet != aspDetailedError)
1553 { 1590 {
1554 row.Set(8, YesNoType.Yes == aspDetailedError ? 1 : 0); 1591 tuple.AspDetailedError = YesNoType.Yes == aspDetailedError ? 1 : 0;
1555 } 1592 }
1556 row.Set(9, httpExpires); 1593
1557 if (CompilerConstants.LongNotSet != cacheControlMaxAge) 1594 if (CompilerConstants.LongNotSet != cacheControlMaxAge)
1558 { 1595 {
1559 row.Set(10, unchecked((int)cacheControlMaxAge)); 1596 tuple.CacheControlMaxAge = unchecked((int)cacheControlMaxAge);
1560 } 1597 }
1561 row.Set(11, cacheControlCustom); 1598
1562 if (YesNoType.NotSet != notCustomError) 1599 if (YesNoType.NotSet != notCustomError)
1563 { 1600 {
1564 row.Set(12, YesNoType.Yes == notCustomError ? 1 : 0); 1601 tuple.NoCustomError = YesNoType.Yes == notCustomError ? 1 : 0;
1565 } 1602 }
1566 1603
1567 if (accessSSLFlagsSet) 1604 if (accessSSLFlagsSet)
1568 { 1605 {
1569 row.Set(13, accessSSLFlags); 1606 tuple.AccessSSLFlags = accessSSLFlags;
1570 } 1607 }
1571 1608
1572 if (null != authenticationProviders) 1609 if (null != authenticationProviders)
1573 { 1610 {
1574 row.Set(14, authenticationProviders); 1611 tuple.AuthenticationProviders = authenticationProviders;
1575 } 1612 }
1576 } 1613 }
1577 1614
@@ -1586,13 +1623,13 @@ namespace WixToolset.Iis
1586 /// <param name="parent">Id of the parent.</param> 1623 /// <param name="parent">Id of the parent.</param>
1587 private void ParseWebErrorElement(Intermediate intermediate, IntermediateSection section, XElement element, WebErrorParentType parentType, string parent) 1624 private void ParseWebErrorElement(Intermediate intermediate, IntermediateSection section, XElement element, WebErrorParentType parentType, string parent)
1588 { 1625 {
1589 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1626 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1590 int errorCode = CompilerConstants.IntegerNotSet; 1627 var errorCode = CompilerConstants.IntegerNotSet;
1591 string file = null; 1628 string file = null;
1592 string url = null; 1629 string url = null;
1593 int subCode = CompilerConstants.IntegerNotSet; 1630 var subCode = CompilerConstants.IntegerNotSet;
1594 1631
1595 foreach (XAttribute attrib in element.Attributes()) 1632 foreach (var attrib in element.Attributes())
1596 { 1633 {
1597 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1634 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1598 { 1635 {
@@ -1641,17 +1678,19 @@ namespace WixToolset.Iis
1641 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 1678 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1642 1679
1643 // Reference ConfigureIIs since nothing will happen without it 1680 // Reference ConfigureIIs since nothing will happen without it
1644 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 1681 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1645 1682
1646 if (!this.Messaging.EncounteredError) 1683 if (!this.Messaging.EncounteredError)
1647 { 1684 {
1648 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebError"); 1685 section.AddTuple(new IIsWebErrorTuple(sourceLineNumbers)
1649 row.Set(0, errorCode); 1686 {
1650 row.Set(1, subCode); 1687 ErrorCode = errorCode,
1651 row.Set(2, (int)parentType); 1688 SubCode = subCode,
1652 row.Set(3, parent); 1689 ParentType = (int)parentType,
1653 row.Set(4, file); 1690 ParentValue = parent,
1654 row.Set(5, url); 1691 File = file,
1692 URL = url,
1693 });
1655 } 1694 }
1656 } 1695 }
1657 1696
@@ -1663,15 +1702,15 @@ namespace WixToolset.Iis
1663 /// <param name="parentWeb">Optional identifier of parent web site.</param> 1702 /// <param name="parentWeb">Optional identifier of parent web site.</param>
1664 private void ParseWebFilterElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb) 1703 private void ParseWebFilterElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb)
1665 { 1704 {
1666 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1705 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1667 Identifier id = null; 1706 Identifier id = null;
1668 string description = null; 1707 string description = null;
1669 int flags = 0; 1708 int flags = 0;
1670 int loadOrder = CompilerConstants.IntegerNotSet; 1709 var loadOrder = CompilerConstants.IntegerNotSet;
1671 string name = null; 1710 string name = null;
1672 string path = null; 1711 string path = null;
1673 1712
1674 foreach (XAttribute attrib in element.Attributes()) 1713 foreach (var attrib in element.Attributes())
1675 { 1714 {
1676 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1715 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1677 { 1716 {
@@ -1717,7 +1756,7 @@ namespace WixToolset.Iis
1717 } 1756 }
1718 1757
1719 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1758 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1720 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebSite", parentWeb); 1759 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebSite, parentWeb);
1721 break; 1760 break;
1722 default: 1761 default:
1723 this.ParseHelper.UnexpectedAttribute(element, attrib); 1762 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -1732,7 +1771,7 @@ namespace WixToolset.Iis
1732 1771
1733 if (null == id) 1772 if (null == id)
1734 { 1773 {
1735 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 1774 id = this.ParseHelper.CreateIdentifier("ifl", name, componentId, path, parentWeb);
1736 } 1775 }
1737 1776
1738 if (null == name) 1777 if (null == name)
@@ -1748,20 +1787,23 @@ namespace WixToolset.Iis
1748 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 1787 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1749 1788
1750 // Reference ConfigureIIs since nothing will happen without it 1789 // Reference ConfigureIIs since nothing will happen without it
1751 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 1790 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1752 1791
1753 if (!this.Messaging.EncounteredError) 1792 if (!this.Messaging.EncounteredError)
1754 { 1793 {
1755 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsFilter", id); 1794 var tuple = section.AddTuple(new IIsFilterTuple(sourceLineNumbers, id)
1756 row.Set(1, name); 1795 {
1757 row.Set(2, componentId); 1796 Name = name,
1758 row.Set(3, path); 1797 ComponentRef = componentId,
1759 row.Set(4, parentWeb); 1798 Path = path,
1760 row.Set(5, description); 1799 WebRef = parentWeb,
1761 row.Set(6, flags); 1800 Description = description,
1801 Flags = flags,
1802 });
1803
1762 if (CompilerConstants.IntegerNotSet != loadOrder) 1804 if (CompilerConstants.IntegerNotSet != loadOrder)
1763 { 1805 {
1764 row.Set(7, loadOrder); 1806 tuple.LoadOrder = loadOrder;
1765 } 1807 }
1766 } 1808 }
1767 } 1809 }
@@ -1772,11 +1814,11 @@ namespace WixToolset.Iis
1772 /// <param name="element">Node to be parsed.</param> 1814 /// <param name="element">Node to be parsed.</param>
1773 private void ParseWebLogElement(Intermediate intermediate, IntermediateSection section, XElement element) 1815 private void ParseWebLogElement(Intermediate intermediate, IntermediateSection section, XElement element)
1774 { 1816 {
1775 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1817 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1776 Identifier id = null; 1818 Identifier id = null;
1777 string type = null; 1819 string type = null;
1778 1820
1779 foreach (XAttribute attrib in element.Attributes()) 1821 foreach (var attrib in element.Attributes())
1780 { 1822 {
1781 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1823 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1782 { 1824 {
@@ -1786,7 +1828,7 @@ namespace WixToolset.Iis
1786 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); 1828 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
1787 break; 1829 break;
1788 case "Type": 1830 case "Type":
1789 string typeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 1831 var typeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
1790 if (0 < typeValue.Length) 1832 if (0 < typeValue.Length)
1791 { 1833 {
1792 switch (typeValue) 1834 switch (typeValue)
@@ -1837,8 +1879,10 @@ namespace WixToolset.Iis
1837 1879
1838 if (!this.Messaging.EncounteredError) 1880 if (!this.Messaging.EncounteredError)
1839 { 1881 {
1840 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebLog", id); 1882 section.AddTuple(new IIsWebLogTuple(sourceLineNumbers, id)
1841 row.Set(1, type); 1883 {
1884 Format = type,
1885 });
1842 } 1886 }
1843 } 1887 }
1844 1888
@@ -1849,11 +1893,11 @@ namespace WixToolset.Iis
1849 /// <param name="componentId">Identifier for parent component.</param> 1893 /// <param name="componentId">Identifier for parent component.</param>
1850 private void ParseWebPropertyElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) 1894 private void ParseWebPropertyElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
1851 { 1895 {
1852 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1896 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1853 Identifier id = null; 1897 Identifier id = null;
1854 string value = null; 1898 string value = null;
1855 1899
1856 foreach (XAttribute attrib in element.Attributes()) 1900 foreach (var attrib in element.Attributes())
1857 { 1901 {
1858 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 1902 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
1859 { 1903 {
@@ -1902,14 +1946,16 @@ namespace WixToolset.Iis
1902 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 1946 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1903 1947
1904 // Reference ConfigureIIs since nothing will happen without it 1948 // Reference ConfigureIIs since nothing will happen without it
1905 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 1949 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1906 1950
1907 if (!this.Messaging.EncounteredError) 1951 if (!this.Messaging.EncounteredError)
1908 { 1952 {
1909 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsProperty", id); 1953 section.AddTuple(new IIsPropertyTuple(sourceLineNumbers, id)
1910 row.Set(1, componentId); 1954 {
1911 row.Set(2, 0); 1955 ComponentRef = componentId,
1912 row.Set(3, value); 1956 Attributes = 0,
1957 Value = value,
1958 });
1913 } 1959 }
1914 } 1960 }
1915 1961
@@ -1920,7 +1966,7 @@ namespace WixToolset.Iis
1920 /// <param name="componentId">Identifier for parent component.</param> 1966 /// <param name="componentId">Identifier for parent component.</param>
1921 private void ParseWebServiceExtensionElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) 1967 private void ParseWebServiceExtensionElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
1922 { 1968 {
1923 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 1969 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
1924 Identifier id = null; 1970 Identifier id = null;
1925 int attributes = 0; 1971 int attributes = 0;
1926 string description = null; 1972 string description = null;
@@ -1978,7 +2024,7 @@ namespace WixToolset.Iis
1978 2024
1979 if (null == id) 2025 if (null == id)
1980 { 2026 {
1981 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 2027 id = this.ParseHelper.CreateIdentifier("iwe", componentId, file);
1982 } 2028 }
1983 2029
1984 if (null == file) 2030 if (null == file)
@@ -1989,16 +2035,18 @@ namespace WixToolset.Iis
1989 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 2035 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1990 2036
1991 // Reference ConfigureIIs since nothing will happen without it 2037 // Reference ConfigureIIs since nothing will happen without it
1992 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 2038 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
1993 2039
1994 if (!this.Messaging.EncounteredError) 2040 if (!this.Messaging.EncounteredError)
1995 { 2041 {
1996 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebServiceExtension", id); 2042 section.AddTuple(new IIsWebServiceExtensionTuple(sourceLineNumbers, id)
1997 row.Set(1, componentId); 2043 {
1998 row.Set(2, file); 2044 ComponentRef = componentId,
1999 row.Set(3, description); 2045 File = file,
2000 row.Set(4, group); 2046 Description = description,
2001 row.Set(5, attributes); 2047 Group = group,
2048 Attributes = attributes,
2049 });
2002 } 2050 }
2003 } 2051 }
2004 2052
@@ -2009,21 +2057,21 @@ namespace WixToolset.Iis
2009 /// <param name="componentId">Optional identifier of parent component.</param> 2057 /// <param name="componentId">Optional identifier of parent component.</param>
2010 private void ParseWebSiteElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) 2058 private void ParseWebSiteElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
2011 { 2059 {
2012 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 2060 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
2013 Identifier id = null; 2061 Identifier id = null;
2014 string application = null; 2062 string application = null;
2015 int attributes = 0; 2063 int attributes = 0;
2016 int connectionTimeout = CompilerConstants.IntegerNotSet; 2064 var connectionTimeout = CompilerConstants.IntegerNotSet;
2017 string description = null; 2065 string description = null;
2018 string directory = null; 2066 string directory = null;
2019 string dirProperties = null; 2067 string dirProperties = null;
2020 string keyAddress = null; 2068 string keyAddress = null;
2021 string log = null; 2069 string log = null;
2022 string siteId = null; 2070 string siteId = null;
2023 int sequence = CompilerConstants.IntegerNotSet; 2071 var sequence = CompilerConstants.IntegerNotSet;
2024 int state = CompilerConstants.IntegerNotSet; 2072 var state = CompilerConstants.IntegerNotSet;
2025 2073
2026 foreach (XAttribute attrib in element.Attributes()) 2074 foreach (var attrib in element.Attributes())
2027 { 2075 {
2028 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 2076 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
2029 { 2077 {
@@ -2070,7 +2118,7 @@ namespace WixToolset.Iis
2070 break; 2118 break;
2071 case "Directory": 2119 case "Directory":
2072 directory = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2120 directory = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2073 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Directory", directory); 2121 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, directory);
2074 break; 2122 break;
2075 case "DirProperties": 2123 case "DirProperties":
2076 if (null == componentId) 2124 if (null == componentId)
@@ -2121,7 +2169,7 @@ namespace WixToolset.Iis
2121 } 2169 }
2122 2170
2123 log = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2171 log = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2124 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebLog", log); 2172 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebLog, log);
2125 break; 2173 break;
2126 default: 2174 default:
2127 this.ParseHelper.UnexpectedAttribute(element, attrib); 2175 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -2136,7 +2184,7 @@ namespace WixToolset.Iis
2136 2184
2137 if (null == id) 2185 if (null == id)
2138 { 2186 {
2139 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 2187 id = this.ParseHelper.CreateIdentifier("iws", description, componentId, siteId, application);
2140 } 2188 }
2141 2189
2142 if (null == description) 2190 if (null == description)
@@ -2149,11 +2197,11 @@ namespace WixToolset.Iis
2149 this.Messaging.Write(IIsErrors.RequiredAttributeUnderComponent(sourceLineNumbers, element.Name.LocalName, "Directory")); 2197 this.Messaging.Write(IIsErrors.RequiredAttributeUnderComponent(sourceLineNumbers, element.Name.LocalName, "Directory"));
2150 } 2198 }
2151 2199
2152 foreach (XElement child in element.Elements()) 2200 foreach (var child in element.Elements())
2153 { 2201 {
2154 if (this.Namespace == child.Name.Namespace) 2202 if (this.Namespace == child.Name.Namespace)
2155 { 2203 {
2156 SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); 2204 var childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
2157 switch (child.Name.LocalName) 2205 switch (child.Name.LocalName)
2158 { 2206 {
2159 case "CertificateRef": 2207 case "CertificateRef":
@@ -2206,7 +2254,7 @@ namespace WixToolset.Iis
2206 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); 2254 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
2207 } 2255 }
2208 2256
2209 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child); 2257 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child, componentId);
2210 if (null == dirProperties) 2258 if (null == dirProperties)
2211 { 2259 {
2212 dirProperties = childWebDirProperties; 2260 dirProperties = childWebDirProperties;
@@ -2262,48 +2310,53 @@ namespace WixToolset.Iis
2262 2310
2263 if (null != application) 2311 if (null != application)
2264 { 2312 {
2265 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebApplication", application); 2313 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebApplication, application);
2266 } 2314 }
2267 2315
2268 if (null != dirProperties) 2316 if (null != dirProperties)
2269 { 2317 {
2270 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebDirProperties", dirProperties); 2318 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebDirProperties, dirProperties);
2271 } 2319 }
2272 2320
2273 if (null != componentId) 2321 if (null != componentId)
2274 { 2322 {
2275 // Reference ConfigureIIs since nothing will happen without it 2323 // Reference ConfigureIIs since nothing will happen without it
2276 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 2324 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
2277 } 2325 }
2278 2326
2279 if (!this.Messaging.EncounteredError) 2327 if (!this.Messaging.EncounteredError)
2280 { 2328 {
2281 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebSite", id); 2329 var tuple = section.AddTuple(new IIsWebSiteTuple(sourceLineNumbers, id)
2282 row.Set(1, componentId); 2330 {
2283 row.Set(2, description); 2331 ComponentRef = componentId,
2332 Description = description,
2333 DirectoryRef = directory,
2334 KeyAddressRef = keyAddress,
2335 DirPropertiesRef = dirProperties,
2336 ApplicationRef = application,
2337 LogRef = log,
2338 WebsiteId = siteId,
2339 });
2340
2284 if (CompilerConstants.IntegerNotSet != connectionTimeout) 2341 if (CompilerConstants.IntegerNotSet != connectionTimeout)
2285 { 2342 {
2286 row.Set(3, connectionTimeout); 2343 tuple.ConnectionTimeout = connectionTimeout;
2287 } 2344 }
2288 row.Set(4, directory); 2345
2289 if (CompilerConstants.IntegerNotSet != state) 2346 if (CompilerConstants.IntegerNotSet != state)
2290 { 2347 {
2291 row.Set(5, state); 2348 tuple.State = state;
2292 } 2349 }
2293 2350
2294 if (0 != attributes) 2351 if (0 != attributes)
2295 { 2352 {
2296 row.Set(6, attributes); 2353 tuple.Attributes = attributes;
2297 } 2354 }
2298 row.Set(7, keyAddress); 2355
2299 row.Set(8, dirProperties);
2300 row.Set(9, application);
2301 if (CompilerConstants.IntegerNotSet != sequence) 2356 if (CompilerConstants.IntegerNotSet != sequence)
2302 { 2357 {
2303 row.Set(10, sequence); 2358 tuple.Sequence = sequence;
2304 } 2359 }
2305 row.Set(11, log);
2306 row.Set(12, siteId);
2307 } 2360 }
2308 } 2361 }
2309 2362
@@ -2315,12 +2368,12 @@ namespace WixToolset.Iis
2315 /// <param name="parent">Id of the parent.</param> 2368 /// <param name="parent">Id of the parent.</param>
2316 private void ParseHttpHeaderElement(Intermediate intermediate, IntermediateSection section, XElement element, HttpHeaderParentType parentType, string parent) 2369 private void ParseHttpHeaderElement(Intermediate intermediate, IntermediateSection section, XElement element, HttpHeaderParentType parentType, string parent)
2317 { 2370 {
2318 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 2371 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
2319 Identifier id = null; 2372 Identifier id = null;
2320 string headerName = null; 2373 string headerName = null;
2321 string headerValue = null; 2374 string headerValue = null;
2322 2375
2323 foreach (XAttribute attrib in element.Attributes()) 2376 foreach (var attrib in element.Attributes())
2324 { 2377 {
2325 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 2378 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
2326 { 2379 {
@@ -2358,15 +2411,20 @@ namespace WixToolset.Iis
2358 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 2411 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
2359 2412
2360 // Reference ConfigureIIs since nothing will happen without it 2413 // Reference ConfigureIIs since nothing will happen without it
2361 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 2414 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
2362 2415
2363 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsHttpHeader", id); 2416 if (!this.Messaging.EncounteredError)
2364 row.Set(1, (int)parentType); 2417 {
2365 row.Set(2, parent); 2418 section.AddTuple(new IIsHttpHeaderTuple(sourceLineNumbers, id)
2366 row.Set(3, headerName); 2419 {
2367 row.Set(4, headerValue); 2420 HttpHeader = id.Id,
2368 row.Set(5, 0); 2421 ParentType = (int)parentType,
2369 //row.Set(6, null); 2422 ParentValue = parent,
2423 Name = headerName,
2424 Value = headerValue,
2425 Attributes = 0,
2426 });
2427 }
2370 } 2428 }
2371 2429
2372 /// <summary> 2430 /// <summary>
@@ -2378,14 +2436,14 @@ namespace WixToolset.Iis
2378 /// <param name="parentAlias">Alias of the parent web site.</param> 2436 /// <param name="parentAlias">Alias of the parent web site.</param>
2379 private void ParseWebVirtualDirElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb, string parentAlias) 2437 private void ParseWebVirtualDirElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string parentWeb, string parentAlias)
2380 { 2438 {
2381 SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); 2439 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
2382 Identifier id = null; 2440 Identifier id = null;
2383 string alias = null; 2441 string alias = null;
2384 string application = null; 2442 string application = null;
2385 string directory = null; 2443 string directory = null;
2386 string dirProperties = null; 2444 string dirProperties = null;
2387 2445
2388 foreach (XAttribute attrib in element.Attributes()) 2446 foreach (var attrib in element.Attributes())
2389 { 2447 {
2390 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) 2448 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
2391 { 2449 {
@@ -2399,7 +2457,7 @@ namespace WixToolset.Iis
2399 break; 2457 break;
2400 case "Directory": 2458 case "Directory":
2401 directory = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2459 directory = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2402 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Directory", directory); 2460 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Directory, directory);
2403 break; 2461 break;
2404 case "DirProperties": 2462 case "DirProperties":
2405 dirProperties = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 2463 dirProperties = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
@@ -2414,7 +2472,7 @@ namespace WixToolset.Iis
2414 } 2472 }
2415 2473
2416 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2474 parentWeb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2417 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebSite", parentWeb); 2475 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebSite, parentWeb);
2418 break; 2476 break;
2419 default: 2477 default:
2420 this.ParseHelper.UnexpectedAttribute(element, attrib); 2478 this.ParseHelper.UnexpectedAttribute(element, attrib);
@@ -2429,7 +2487,7 @@ namespace WixToolset.Iis
2429 2487
2430 if (null == id) 2488 if (null == id)
2431 { 2489 {
2432 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); 2490 id = this.ParseHelper.CreateIdentifier("wvd", alias, directory, dirProperties, application, parentWeb);
2433 } 2491 }
2434 2492
2435 if (null == alias) 2493 if (null == alias)
@@ -2461,11 +2519,11 @@ namespace WixToolset.Iis
2461 alias = String.Concat(parentAlias, "/", alias); 2519 alias = String.Concat(parentAlias, "/", alias);
2462 } 2520 }
2463 2521
2464 foreach (XElement child in element.Elements()) 2522 foreach (var child in element.Elements())
2465 { 2523 {
2466 if (this.Namespace == child.Name.Namespace) 2524 if (this.Namespace == child.Name.Namespace)
2467 { 2525 {
2468 SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); 2526 var childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
2469 switch (child.Name.LocalName) 2527 switch (child.Name.LocalName)
2470 { 2528 {
2471 case "WebApplication": 2529 case "WebApplication":
@@ -2482,7 +2540,7 @@ namespace WixToolset.Iis
2482 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); 2540 this.Messaging.Write(IIsErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
2483 } 2541 }
2484 2542
2485 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child); 2543 string childWebDirProperties = this.ParseWebDirPropertiesElement(intermediate, section, child, componentId);
2486 if (null == dirProperties) 2544 if (null == dirProperties)
2487 { 2545 {
2488 dirProperties = childWebDirProperties; 2546 dirProperties = childWebDirProperties;
@@ -2518,27 +2576,34 @@ namespace WixToolset.Iis
2518 2576
2519 if (null != dirProperties) 2577 if (null != dirProperties)
2520 { 2578 {
2521 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebDirProperties", dirProperties); 2579 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebDirProperties, dirProperties);
2522 } 2580 }
2523 2581
2524 if (null != application) 2582 if (null != application)
2525 { 2583 {
2526 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "IIsWebApplication", application); 2584 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, IisTupleDefinitions.IIsWebApplication, application);
2527 } 2585 }
2528 2586
2529 // Reference ConfigureIIs since nothing will happen without it 2587 // Reference ConfigureIIs since nothing will happen without it
2530 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureIIs"); 2588 this.AddReferenceToConfigureIIs(section, sourceLineNumbers);
2531 2589
2532 if (!this.Messaging.EncounteredError) 2590 if (!this.Messaging.EncounteredError)
2533 { 2591 {
2534 var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "IIsWebVirtualDir", id); 2592 section.AddTuple(new IIsWebVirtualDirTuple(sourceLineNumbers, id)
2535 row.Set(1, componentId); 2593 {
2536 row.Set(2, parentWeb); 2594 ComponentRef = componentId,
2537 row.Set(3, alias); 2595 WebRef = parentWeb,
2538 row.Set(4, directory); 2596 Alias = alias,
2539 row.Set(5, dirProperties); 2597 DirectoryRef = directory,
2540 row.Set(6, application); 2598 DirPropertiesRef = dirProperties,
2599 ApplicationRef = application,
2600 });
2541 } 2601 }
2542 } 2602 }
2603
2604 private void AddReferenceToConfigureIIs(IntermediateSection section, SourceLineNumber sourceLineNumbers)
2605 {
2606 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.CustomAction, "ConfigureIIs");
2607 }
2543 } 2608 }
2544} 2609}