From 311dbab658184e603953791a075c776456226b95 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 29 May 2020 11:44:46 +1000 Subject: Add overloads to WindowsInstallerData.Load for table definitions. --- src/WixToolset.Data/WindowsInstaller/TableDefinition.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/WixToolset.Data/WindowsInstaller/TableDefinition.cs') diff --git a/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs b/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs index 9ec37895..214544ca 100644 --- a/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs +++ b/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs @@ -156,12 +156,16 @@ namespace WixToolset.Data.WindowsInstaller /// Parses table definition from xml reader. /// /// Reader to get data from. + /// Table definitions to use for strongly-typed rows. /// The TableDefintion represented by the Xml. - internal static TableDefinition Read(XmlReader reader) + internal static TableDefinition Read(XmlReader reader, TableDefinitionCollection tableDefinitions) { var empty = reader.IsEmptyElement; string name = null; + IntermediateTupleDefinition tupleDefinition = null; var unreal = false; + var tupleIdIsPrimaryKey = false; + Type strongRowType = null; while (reader.MoveToNextAttribute()) { @@ -181,6 +185,13 @@ namespace WixToolset.Data.WindowsInstaller throw new XmlException(); } + if (tableDefinitions.TryGet(name, out var tableDefinition)) + { + tupleDefinition = tableDefinition.TupleDefinition; + tupleIdIsPrimaryKey = tableDefinition.TupleIdIsPrimaryKey; + strongRowType = tableDefinition.StrongRowType; + } + var columns = new List(); var hasPrimaryKeyColumn = false; @@ -226,7 +237,7 @@ namespace WixToolset.Data.WindowsInstaller } } - return new TableDefinition(name, null, columns.ToArray(), unreal); + return new TableDefinition(name, tupleDefinition, columns.ToArray(), unreal, tupleIdIsPrimaryKey, strongRowType); } /// -- cgit v1.2.3-55-g6feb