diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-18 13:53:54 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-18 21:25:30 +1000 |
commit | 1c933963d1354495d4a31a08baf7f1240b5fbfce (patch) | |
tree | f2190fc0336f57d3c6b408e1a5d57b0b9c343092 /src | |
parent | 2b3c14c790e8a95edabecf2d7bb50baa58d8e95b (diff) | |
download | wix-1c933963d1354495d4a31a08baf7f1240b5fbfce.tar.gz wix-1c933963d1354495d4a31a08baf7f1240b5fbfce.tar.bz2 wix-1c933963d1354495d4a31a08baf7f1240b5fbfce.zip |
Add ability for an extension to have a custom strongly typed row during binding.
Remove some unused functionality in Table and Row.
Use strongRowType in core tables.
Diffstat (limited to 'src')
16 files changed, 136 insertions, 94 deletions
diff --git a/src/WixToolset.Data/WindowsInstaller/Row.cs b/src/WixToolset.Data/WindowsInstaller/Row.cs index a7a63d58..af0a323e 100644 --- a/src/WixToolset.Data/WindowsInstaller/Row.cs +++ b/src/WixToolset.Data/WindowsInstaller/Row.cs | |||
@@ -47,22 +47,6 @@ namespace WixToolset.Data.WindowsInstaller | |||
47 | } | 47 | } |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Creates a shallow copy of a row from another row. | ||
51 | /// </summary> | ||
52 | /// <param name="source">The row the data is copied from.</param> | ||
53 | protected Row(Row source) | ||
54 | { | ||
55 | this.Table = source.Table; | ||
56 | this.TableDefinition = source.TableDefinition; | ||
57 | this.Number = source.Number; | ||
58 | this.Operation = source.Operation; | ||
59 | this.Redundant = source.Redundant; | ||
60 | this.SectionId = source.SectionId; | ||
61 | this.SourceLineNumbers = source.SourceLineNumbers; | ||
62 | this.Fields = source.Fields; | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Gets or sets the row transform operation. | 50 | /// Gets or sets the row transform operation. |
67 | /// </summary> | 51 | /// </summary> |
68 | /// <value>The row transform operation.</value> | 52 | /// <value>The row transform operation.</value> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/BBControlRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/BBControlRow.cs index bf962e73..20482560 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/BBControlRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/BBControlRow.cs | |||
@@ -19,6 +19,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | public BBControlRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
23 | base(sourceLineNumbers, tableDefinition) | ||
24 | { | ||
25 | } | ||
26 | |||
22 | /// <summary> | 27 | /// <summary> |
23 | /// Gets or sets the dialog of the Control row. | 28 | /// Gets or sets the dialog of the Control row. |
24 | /// </summary> | 29 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/ComponentRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/ComponentRow.cs index 001703ee..b7836241 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/ComponentRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/ComponentRow.cs | |||
@@ -19,6 +19,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | public ComponentRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
23 | base(sourceLineNumbers, tableDefinition) | ||
24 | { | ||
25 | } | ||
26 | |||
22 | /// <summary> | 27 | /// <summary> |
23 | /// Gets or sets the identifier for this Component row. | 28 | /// Gets or sets the identifier for this Component row. |
24 | /// </summary> | 29 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/ControlRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/ControlRow.cs index 95289dea..e0ae2de0 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/ControlRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/ControlRow.cs | |||
@@ -19,6 +19,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | public ControlRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
23 | base(sourceLineNumbers, tableDefinition) | ||
24 | { | ||
25 | } | ||
26 | |||
22 | /// <summary> | 27 | /// <summary> |
23 | /// Gets or sets the dialog of the Control row. | 28 | /// Gets or sets the dialog of the Control row. |
24 | /// </summary> | 29 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/MediaRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/MediaRow.cs index b931632f..b8fa5e83 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/MediaRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/MediaRow.cs | |||
@@ -17,6 +17,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
17 | { | 17 | { |
18 | } | 18 | } |
19 | 19 | ||
20 | public MediaRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
21 | base(sourceLineNumbers, tableDefinition) | ||
22 | { | ||
23 | } | ||
24 | |||
20 | /// <summary> | 25 | /// <summary> |
21 | /// Gets or sets the disk id for this media row. | 26 | /// Gets or sets the disk id for this media row. |
22 | /// </summary> | 27 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/PropertyRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/PropertyRow.cs index 3aba5de6..b4212430 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/PropertyRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/PropertyRow.cs | |||
@@ -17,6 +17,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
17 | { | 17 | { |
18 | } | 18 | } |
19 | 19 | ||
20 | public PropertyRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
21 | base(sourceLineNumbers, tableDefinition) | ||
22 | { | ||
23 | } | ||
24 | |||
20 | /// <summary> | 25 | /// <summary> |
21 | /// Gets and sets the property name for the row. | 26 | /// Gets and sets the property name for the row. |
22 | /// </summary> | 27 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/UpgradeRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/UpgradeRow.cs index d757c8d3..dbbfa0f9 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/UpgradeRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/UpgradeRow.cs | |||
@@ -17,6 +17,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
17 | { | 17 | { |
18 | } | 18 | } |
19 | 19 | ||
20 | public UpgradeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
21 | base(sourceLineNumbers, tableDefinition) | ||
22 | { | ||
23 | } | ||
24 | |||
20 | /// <summary> | 25 | /// <summary> |
21 | /// Gets and sets the upgrade code for the row. | 26 | /// Gets and sets the upgrade code for the row. |
22 | /// </summary> | 27 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixActionRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixActionRow.cs index f7bc784d..61240820 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/WixActionRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/WixActionRow.cs | |||
@@ -23,13 +23,8 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | /// <summary> | 26 | public WixActionRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : |
27 | /// Instantiates an ActionRow by copying data from another ActionRow. | 27 | base(sourceLineNumbers, tableDefinition) |
28 | /// </summary> | ||
29 | /// <param name="source">The row the data is copied from.</param> | ||
30 | /// <remarks>The previous and next action collections are not copied.</remarks> | ||
31 | private WixActionRow(WixActionRow source) | ||
32 | : base(source) | ||
33 | { | 28 | { |
34 | } | 29 | } |
35 | 30 | ||
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs index 2abd7656..0e942724 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs | |||
@@ -20,6 +20,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | public WixComplexReferenceRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) | ||
24 | : base(sourceLineNumbers, tableDefinition) | ||
25 | { | ||
26 | } | ||
27 | |||
23 | /// <summary> | 28 | /// <summary> |
24 | /// Gets the parent type of the complex reference. | 29 | /// Gets the parent type of the complex reference. |
25 | /// </summary> | 30 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixGroupRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixGroupRow.cs index e59df729..bbdbc6b6 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/WixGroupRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/WixGroupRow.cs | |||
@@ -19,6 +19,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | public WixGroupRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) | ||
23 | : base(sourceLineNumbers, tableDefinition) | ||
24 | { | ||
25 | } | ||
26 | |||
22 | /// <summary> | 27 | /// <summary> |
23 | /// Gets or sets the parent identifier of the complex reference. | 28 | /// Gets or sets the parent identifier of the complex reference. |
24 | /// </summary> | 29 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixMediaTemplateRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixMediaTemplateRow.cs index b2a64356..29479147 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/WixMediaTemplateRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/WixMediaTemplateRow.cs | |||
@@ -17,6 +17,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
17 | { | 17 | { |
18 | } | 18 | } |
19 | 19 | ||
20 | public WixMediaTemplateRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) | ||
21 | : base(sourceLineNumbers, tableDefinition) | ||
22 | { | ||
23 | } | ||
24 | |||
20 | /// <summary> | 25 | /// <summary> |
21 | /// Gets or sets the cabinet template name for this media template row. | 26 | /// Gets or sets the cabinet template name for this media template row. |
22 | /// </summary> | 27 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixPropertyRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixPropertyRow.cs index 2f356b71..8a54d36e 100644 --- a/src/WixToolset.Data/WindowsInstaller/Rows/WixPropertyRow.cs +++ b/src/WixToolset.Data/WindowsInstaller/Rows/WixPropertyRow.cs | |||
@@ -18,6 +18,11 @@ namespace WixToolset.Data.WindowsInstaller.Rows | |||
18 | { | 18 | { |
19 | } | 19 | } |
20 | 20 | ||
21 | public WixPropertyRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) : | ||
22 | base(sourceLineNumbers, tableDefinition) | ||
23 | { | ||
24 | } | ||
25 | |||
21 | /// <summary> | 26 | /// <summary> |
22 | /// Gets and sets the id for this property row. | 27 | /// Gets and sets the id for this property row. |
23 | /// </summary> | 28 | /// </summary> |
diff --git a/src/WixToolset.Data/WindowsInstaller/Table.cs b/src/WixToolset.Data/WindowsInstaller/Table.cs index 54753dee..ca6fe3ba 100644 --- a/src/WixToolset.Data/WindowsInstaller/Table.cs +++ b/src/WixToolset.Data/WindowsInstaller/Table.cs | |||
@@ -6,7 +6,6 @@ namespace WixToolset.Data.WindowsInstaller | |||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Diagnostics; | 7 | using System.Diagnostics; |
8 | using System.Xml; | 8 | using System.Xml; |
9 | using WixToolset.Data.WindowsInstaller.Rows; | ||
10 | 9 | ||
11 | /// <summary> | 10 | /// <summary> |
12 | /// Object that represents a table in a database. | 11 | /// Object that represents a table in a database. |
@@ -49,79 +48,14 @@ namespace WixToolset.Data.WindowsInstaller | |||
49 | public IList<Row> Rows { get; } | 48 | public IList<Row> Rows { get; } |
50 | 49 | ||
51 | /// <summary> | 50 | /// <summary> |
52 | /// Creates a new row in the table. | 51 | /// Creates a new row and adds it to the table. |
53 | /// </summary> | 52 | /// </summary> |
54 | /// <param name="sourceLineNumbers">Original source lines for this row.</param> | 53 | /// <param name="sourceLineNumbers">Original source lines for this row.</param> |
55 | /// <param name="add">Specifies whether to only create the row or add it to the table automatically.</param> | ||
56 | /// <returns>Row created in table.</returns> | 54 | /// <returns>Row created in table.</returns> |
57 | public Row CreateRow(SourceLineNumber sourceLineNumbers, bool add = true) | 55 | public Row CreateRow(SourceLineNumber sourceLineNumbers) |
58 | { | 56 | { |
59 | Row row; | 57 | var row = this.Definition.CreateRow(sourceLineNumbers, this); |
60 | 58 | this.Rows.Add(row); | |
61 | switch (this.Name) | ||
62 | { | ||
63 | case "BBControl": | ||
64 | row = new BBControlRow(sourceLineNumbers, this); | ||
65 | break; | ||
66 | case "Component": | ||
67 | row = new ComponentRow(sourceLineNumbers, this); | ||
68 | break; | ||
69 | case "Control": | ||
70 | row = new ControlRow(sourceLineNumbers, this); | ||
71 | break; | ||
72 | case "File": | ||
73 | row = new FileRow(sourceLineNumbers, this); | ||
74 | break; | ||
75 | case "Media": | ||
76 | row = new MediaRow(sourceLineNumbers, this); | ||
77 | break; | ||
78 | case "Property": | ||
79 | row = new PropertyRow(sourceLineNumbers, this); | ||
80 | break; | ||
81 | case "Upgrade": | ||
82 | row = new UpgradeRow(sourceLineNumbers, this); | ||
83 | break; | ||
84 | case "WixAction": | ||
85 | row = new WixActionRow(sourceLineNumbers, this); | ||
86 | break; | ||
87 | case "WixComplexReference": | ||
88 | row = new WixComplexReferenceRow(sourceLineNumbers, this); | ||
89 | break; | ||
90 | case "WixDeltaPatchFile": | ||
91 | row = new WixDeltaPatchFileRow(sourceLineNumbers, this); | ||
92 | break; | ||
93 | case "WixDeltaPatchSymbolPaths": | ||
94 | row = new WixDeltaPatchSymbolPathsRow(sourceLineNumbers, this); | ||
95 | break; | ||
96 | case "WixGroup": | ||
97 | row = new WixGroupRow(sourceLineNumbers, this); | ||
98 | break; | ||
99 | case "WixMedia": | ||
100 | row = new WixMediaRow(sourceLineNumbers, this); | ||
101 | break; | ||
102 | case "WixMediaTemplate": | ||
103 | row = new WixMediaTemplateRow(sourceLineNumbers, this); | ||
104 | break; | ||
105 | case "WixMerge": | ||
106 | row = new WixMergeRow(sourceLineNumbers, this); | ||
107 | break; | ||
108 | case "WixProperty": | ||
109 | row = new WixPropertyRow(sourceLineNumbers, this); | ||
110 | break; | ||
111 | case "WixSimpleReference": | ||
112 | row = new WixSimpleReferenceRow(sourceLineNumbers, this); | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | row = new Row(sourceLineNumbers, this); | ||
117 | break; | ||
118 | } | ||
119 | |||
120 | if (add) | ||
121 | { | ||
122 | this.Rows.Add(row); | ||
123 | } | ||
124 | |||
125 | return row; | 59 | return row; |
126 | } | 60 | } |
127 | 61 | ||
diff --git a/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs b/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs index 7c4a3e9d..9ec37895 100644 --- a/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs +++ b/src/WixToolset.Data/WindowsInstaller/TableDefinition.cs | |||
@@ -26,18 +26,22 @@ namespace WixToolset.Data.WindowsInstaller | |||
26 | /// <param name="columns">Column definitions for the table.</param> | 26 | /// <param name="columns">Column definitions for the table.</param> |
27 | /// <param name="unreal">Flag if table is unreal.</param> | 27 | /// <param name="unreal">Flag if table is unreal.</param> |
28 | /// <param name="tupleIdIsPrimaryKey">Whether the primary key is the id of the tuple definition associated with this table.</param> | 28 | /// <param name="tupleIdIsPrimaryKey">Whether the primary key is the id of the tuple definition associated with this table.</param> |
29 | public TableDefinition(string name, IntermediateTupleDefinition tupleDefinition, IEnumerable<ColumnDefinition> columns, bool unreal = false, bool tupleIdIsPrimaryKey = false) | 29 | public TableDefinition(string name, IntermediateTupleDefinition tupleDefinition, IEnumerable<ColumnDefinition> columns, bool unreal = false, bool tupleIdIsPrimaryKey = false, Type strongRowType = null) |
30 | { | 30 | { |
31 | this.Name = name; | 31 | this.Name = name; |
32 | this.TupleDefinition = tupleDefinition; | 32 | this.TupleDefinition = tupleDefinition; |
33 | this.TupleIdIsPrimaryKey = tupleIdIsPrimaryKey; | 33 | this.TupleIdIsPrimaryKey = tupleIdIsPrimaryKey; |
34 | this.Unreal = unreal; | 34 | this.Unreal = unreal; |
35 | this.Columns = columns?.ToArray(); | 35 | this.Columns = columns?.ToArray(); |
36 | this.StrongRowType = strongRowType ?? typeof(Row); | ||
36 | 37 | ||
37 | if (this.Columns == null || this.Columns.Length == 0) | 38 | if (this.Columns == null || this.Columns.Length == 0) |
38 | { | 39 | { |
39 | throw new ArgumentOutOfRangeException(nameof(columns)); | 40 | throw new ArgumentOutOfRangeException(nameof(columns)); |
40 | } | 41 | } |
42 | #if DEBUG | ||
43 | if (this.StrongRowType != typeof(Row) && !this.StrongRowType.IsSubclassOf(typeof(Row))) { throw new ArgumentException(nameof(strongRowType)); } | ||
44 | #endif | ||
41 | } | 45 | } |
42 | 46 | ||
43 | /// <summary> | 47 | /// <summary> |
@@ -70,6 +74,8 @@ namespace WixToolset.Data.WindowsInstaller | |||
70 | /// <value>Flag if table is unreal.</value> | 74 | /// <value>Flag if table is unreal.</value> |
71 | public bool TupleIdIsPrimaryKey { get; } | 75 | public bool TupleIdIsPrimaryKey { get; } |
72 | 76 | ||
77 | private Type StrongRowType { get; } | ||
78 | |||
73 | /// <summary> | 79 | /// <summary> |
74 | /// Gets the column definition in the table by index. | 80 | /// Gets the column definition in the table by index. |
75 | /// </summary> | 81 | /// </summary> |
@@ -78,6 +84,31 @@ namespace WixToolset.Data.WindowsInstaller | |||
78 | public ColumnDefinition this[int columnIndex] => this.Columns[columnIndex]; | 84 | public ColumnDefinition this[int columnIndex] => this.Columns[columnIndex]; |
79 | 85 | ||
80 | /// <summary> | 86 | /// <summary> |
87 | /// In general this method shouldn't be used - create rows from a Table instead. | ||
88 | /// Creates a new row object of the type specified in this definition. | ||
89 | /// </summary> | ||
90 | /// <param name="sourceLineNumbers">Original source lines for this row.</param> | ||
91 | /// <returns>Created row.</returns> | ||
92 | public Row CreateRow(SourceLineNumber sourceLineNumbers) | ||
93 | { | ||
94 | var result = (Row)Activator.CreateInstance(this.StrongRowType, sourceLineNumbers, this); | ||
95 | return result; | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Creates a new row object of the type specified in this definition for the given table. | ||
100 | /// External callers should create the row from the table. | ||
101 | /// </summary> | ||
102 | /// <param name="sourceLineNumbers">Original source lines for this row.</param> | ||
103 | /// <param name="table">The owning table for this row.</param> | ||
104 | /// <returns>Created row.</returns> | ||
105 | internal Row CreateRow(SourceLineNumber sourceLineNumbers, Table table) | ||
106 | { | ||
107 | var result = (Row)Activator.CreateInstance(this.StrongRowType, sourceLineNumbers, table); | ||
108 | return result; | ||
109 | } | ||
110 | |||
111 | /// <summary> | ||
81 | /// Compares this table definition to another table definition. | 112 | /// Compares this table definition to another table definition. |
82 | /// </summary> | 113 | /// </summary> |
83 | /// <remarks> | 114 | /// <remarks> |
diff --git a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs index f6c07a83..3a1a8916 100644 --- a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs +++ b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Data.WindowsInstaller | 3 | namespace WixToolset.Data.WindowsInstaller |
4 | { | 4 | { |
5 | using WixToolset.Data.WindowsInstaller.Rows; | ||
6 | |||
5 | public static class WindowsInstallerTableDefinitions | 7 | public static class WindowsInstallerTableDefinitions |
6 | { | 8 | { |
7 | public static readonly TableDefinition ActionText = new TableDefinition( | 9 | public static readonly TableDefinition ActionText = new TableDefinition( |
@@ -111,6 +113,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
111 | new ColumnDefinition("Property", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Name of property, uppercase if settable by launcher or loader.", modularizeType: ColumnModularizeType.Column), | 113 | new ColumnDefinition("Property", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Name of property, uppercase if settable by launcher or loader.", modularizeType: ColumnModularizeType.Column), |
112 | new ColumnDefinition("Value", ColumnType.Localized, 0, primaryKey: false, nullable: false, ColumnCategory.Text, description: "String value for property. Never null or empty."), | 114 | new ColumnDefinition("Value", ColumnType.Localized, 0, primaryKey: false, nullable: false, ColumnCategory.Text, description: "String value for property. Never null or empty."), |
113 | }, | 115 | }, |
116 | strongRowType: typeof(PropertyRow), | ||
114 | tupleIdIsPrimaryKey: true | 117 | tupleIdIsPrimaryKey: true |
115 | ); | 118 | ); |
116 | 119 | ||
@@ -129,6 +132,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
129 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied to this control."), | 132 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied to this control."), |
130 | new ColumnDefinition("Text", ColumnType.Localized, 50, primaryKey: false, nullable: true, ColumnCategory.Text, description: "A string used to set the initial text contained within a control (if appropriate)."), | 133 | new ColumnDefinition("Text", ColumnType.Localized, 50, primaryKey: false, nullable: true, ColumnCategory.Text, description: "A string used to set the initial text contained within a control (if appropriate)."), |
131 | }, | 134 | }, |
135 | strongRowType: typeof(BBControlRow), | ||
132 | tupleIdIsPrimaryKey: false | 136 | tupleIdIsPrimaryKey: false |
133 | ); | 137 | ); |
134 | 138 | ||
@@ -200,6 +204,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
200 | new ColumnDefinition("DiskId", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 1, maxValue: 32767, description: "Disk identifier for the file.", unreal: true), | 204 | new ColumnDefinition("DiskId", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 1, maxValue: 32767, description: "Disk identifier for the file.", unreal: true), |
201 | new ColumnDefinition("Source", ColumnType.Object, 0, primaryKey: false, nullable: false, ColumnCategory.Binary, description: "Path to source of file.", unreal: true), | 205 | new ColumnDefinition("Source", ColumnType.Object, 0, primaryKey: false, nullable: false, ColumnCategory.Binary, description: "Path to source of file.", unreal: true), |
202 | }, | 206 | }, |
207 | strongRowType: typeof(FileRow), | ||
203 | tupleIdIsPrimaryKey: true | 208 | tupleIdIsPrimaryKey: true |
204 | ); | 209 | ); |
205 | 210 | ||
@@ -258,6 +263,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
258 | new ColumnDefinition("Condition", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Condition, description: "A conditional statement that will disable this component if the specified condition evaluates to the 'True' state. If a component is disabled, it will not be installed, regardless of the 'Action' state associated with the component.", modularizeType: ColumnModularizeType.Condition, forceLocalizable: true), | 263 | new ColumnDefinition("Condition", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Condition, description: "A conditional statement that will disable this component if the specified condition evaluates to the 'True' state. If a component is disabled, it will not be installed, regardless of the 'Action' state associated with the component.", modularizeType: ColumnModularizeType.Condition, forceLocalizable: true), |
259 | new ColumnDefinition("KeyPath", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "File;Registry;ODBCDataSource", keyColumn: 1, description: "Either the primary key into the File table, Registry table, or ODBCDataSource table. This extract path is stored when the component is installed, and is used to detect the presence of the component and to return the path to it.", modularizeType: ColumnModularizeType.Column), | 264 | new ColumnDefinition("KeyPath", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "File;Registry;ODBCDataSource", keyColumn: 1, description: "Either the primary key into the File table, Registry table, or ODBCDataSource table. This extract path is stored when the component is installed, and is used to detect the presence of the component and to return the path to it.", modularizeType: ColumnModularizeType.Column), |
260 | }, | 265 | }, |
266 | strongRowType: typeof(ComponentRow), | ||
261 | tupleIdIsPrimaryKey: true | 267 | tupleIdIsPrimaryKey: true |
262 | ); | 268 | ); |
263 | 269 | ||
@@ -353,6 +359,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
353 | new ColumnDefinition("Control_Next", ColumnType.String, 50, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Control", keyColumn: 2, description: "The name of an other control on the same dialog. This link defines the tab order of the controls. The links have to form one or more cycles!"), | 359 | new ColumnDefinition("Control_Next", ColumnType.String, 50, primaryKey: false, nullable: true, ColumnCategory.Identifier, keyTable: "Control", keyColumn: 2, description: "The name of an other control on the same dialog. This link defines the tab order of the controls. The links have to form one or more cycles!"), |
354 | new ColumnDefinition("Help", ColumnType.Localized, 50, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The help strings used with the button. The text is optional. "), | 360 | new ColumnDefinition("Help", ColumnType.Localized, 50, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The help strings used with the button. The text is optional. "), |
355 | }, | 361 | }, |
362 | strongRowType: typeof(ControlRow), | ||
356 | tupleIdIsPrimaryKey: false | 363 | tupleIdIsPrimaryKey: false |
357 | ); | 364 | ); |
358 | 365 | ||
@@ -708,6 +715,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
708 | new ColumnDefinition("VolumeLabel", ColumnType.String, 32, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The label attributed to the volume."), | 715 | new ColumnDefinition("VolumeLabel", ColumnType.String, 32, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The label attributed to the volume."), |
709 | new ColumnDefinition("Source", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Property, description: "The property defining the location of the cabinet file."), | 716 | new ColumnDefinition("Source", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Property, description: "The property defining the location of the cabinet file."), |
710 | }, | 717 | }, |
718 | strongRowType: typeof(MediaRow), | ||
711 | tupleIdIsPrimaryKey: false | 719 | tupleIdIsPrimaryKey: false |
712 | ); | 720 | ); |
713 | 721 | ||
@@ -1330,6 +1338,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1330 | new ColumnDefinition("Remove", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The list of features to remove when uninstalling a product from this set. The default is \"ALL\"."), | 1338 | new ColumnDefinition("Remove", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "The list of features to remove when uninstalling a product from this set. The default is \"ALL\"."), |
1331 | new ColumnDefinition("ActionProperty", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.UpperCase, description: "The property to set when a product in this set is found."), | 1339 | new ColumnDefinition("ActionProperty", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.UpperCase, description: "The property to set when a product in this set is found."), |
1332 | }, | 1340 | }, |
1341 | strongRowType: typeof(UpgradeRow), | ||
1333 | tupleIdIsPrimaryKey: false | 1342 | tupleIdIsPrimaryKey: false |
1334 | ); | 1343 | ); |
1335 | 1344 | ||
@@ -1666,6 +1675,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1666 | new ColumnDefinition("Overridable", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 1675 | new ColumnDefinition("Overridable", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
1667 | }, | 1676 | }, |
1668 | unreal: true, | 1677 | unreal: true, |
1678 | strongRowType: typeof(WixActionRow), | ||
1669 | tupleIdIsPrimaryKey: false | 1679 | tupleIdIsPrimaryKey: false |
1670 | ); | 1680 | ); |
1671 | 1681 | ||
@@ -1695,6 +1705,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1695 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 1705 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
1696 | }, | 1706 | }, |
1697 | unreal: true, | 1707 | unreal: true, |
1708 | strongRowType: typeof(WixComplexReferenceRow), | ||
1698 | tupleIdIsPrimaryKey: false | 1709 | tupleIdIsPrimaryKey: false |
1699 | ); | 1710 | ); |
1700 | 1711 | ||
@@ -1814,6 +1825,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1814 | new ColumnDefinition("ChildType", ColumnType.String, 0, primaryKey: true, nullable: false, ColumnCategory.Unknown, description: "Primary key used to identify a particular child type in a child table."), | 1825 | new ColumnDefinition("ChildType", ColumnType.String, 0, primaryKey: true, nullable: false, ColumnCategory.Unknown, description: "Primary key used to identify a particular child type in a child table."), |
1815 | }, | 1826 | }, |
1816 | unreal: true, | 1827 | unreal: true, |
1828 | strongRowType: typeof(WixGroupRow), | ||
1817 | tupleIdIsPrimaryKey: false | 1829 | tupleIdIsPrimaryKey: false |
1818 | ); | 1830 | ); |
1819 | 1831 | ||
@@ -1923,6 +1935,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1923 | new ColumnDefinition("Layout", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Unknown), | 1935 | new ColumnDefinition("Layout", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Unknown), |
1924 | }, | 1936 | }, |
1925 | unreal: true, | 1937 | unreal: true, |
1938 | strongRowType: typeof(WixMediaRow), | ||
1926 | tupleIdIsPrimaryKey: false | 1939 | tupleIdIsPrimaryKey: false |
1927 | ); | 1940 | ); |
1928 | 1941 | ||
@@ -1939,6 +1952,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1939 | new ColumnDefinition("MaximumCabinetSizeForLargeFileSplitting", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 1952 | new ColumnDefinition("MaximumCabinetSizeForLargeFileSplitting", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
1940 | }, | 1953 | }, |
1941 | unreal: true, | 1954 | unreal: true, |
1955 | strongRowType: typeof(WixMediaTemplateRow), | ||
1942 | tupleIdIsPrimaryKey: false | 1956 | tupleIdIsPrimaryKey: false |
1943 | ); | 1957 | ); |
1944 | 1958 | ||
@@ -1957,6 +1971,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1957 | new ColumnDefinition("Feature_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 1971 | new ColumnDefinition("Feature_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
1958 | }, | 1972 | }, |
1959 | unreal: true, | 1973 | unreal: true, |
1974 | strongRowType: typeof(WixMergeRow), | ||
1960 | tupleIdIsPrimaryKey: true | 1975 | tupleIdIsPrimaryKey: true |
1961 | ); | 1976 | ); |
1962 | 1977 | ||
@@ -1987,6 +2002,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1987 | new ColumnDefinition("SymbolPaths", ColumnType.Preserved, 0, primaryKey: false, nullable: true, ColumnCategory.Text), | 2002 | new ColumnDefinition("SymbolPaths", ColumnType.Preserved, 0, primaryKey: false, nullable: true, ColumnCategory.Text), |
1988 | }, | 2003 | }, |
1989 | unreal: true, | 2004 | unreal: true, |
2005 | strongRowType: typeof(WixDeltaPatchFileRow), | ||
1990 | tupleIdIsPrimaryKey: false | 2006 | tupleIdIsPrimaryKey: false |
1991 | ); | 2007 | ); |
1992 | 2008 | ||
@@ -2000,6 +2016,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
2000 | new ColumnDefinition("SymbolPaths", ColumnType.Preserved, 0, primaryKey: false, nullable: false, ColumnCategory.Text), | 2016 | new ColumnDefinition("SymbolPaths", ColumnType.Preserved, 0, primaryKey: false, nullable: false, ColumnCategory.Text), |
2001 | }, | 2017 | }, |
2002 | unreal: true, | 2018 | unreal: true, |
2019 | strongRowType: typeof(WixDeltaPatchSymbolPathsRow), | ||
2003 | tupleIdIsPrimaryKey: false | 2020 | tupleIdIsPrimaryKey: false |
2004 | ); | 2021 | ); |
2005 | 2022 | ||
@@ -2012,6 +2029,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
2012 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 2029 | new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
2013 | }, | 2030 | }, |
2014 | unreal: true, | 2031 | unreal: true, |
2032 | strongRowType: typeof(WixPropertyRow), | ||
2015 | tupleIdIsPrimaryKey: false | 2033 | tupleIdIsPrimaryKey: false |
2016 | ); | 2034 | ); |
2017 | 2035 | ||
@@ -2024,6 +2042,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
2024 | new ColumnDefinition("PrimaryKeys", ColumnType.String, 0, primaryKey: false, nullable: false, ColumnCategory.Unknown), | 2042 | new ColumnDefinition("PrimaryKeys", ColumnType.String, 0, primaryKey: false, nullable: false, ColumnCategory.Unknown), |
2025 | }, | 2043 | }, |
2026 | unreal: true, | 2044 | unreal: true, |
2045 | strongRowType: typeof(WixSimpleReferenceRow), | ||
2027 | tupleIdIsPrimaryKey: false | 2046 | tupleIdIsPrimaryKey: false |
2028 | ); | 2047 | ); |
2029 | 2048 | ||
diff --git a/src/test/WixToolsetTest.Data/WindowsInstallerTableDefinitionsFixture.cs b/src/test/WixToolsetTest.Data/WindowsInstallerTableDefinitionsFixture.cs new file mode 100644 index 00000000..5621a756 --- /dev/null +++ b/src/test/WixToolsetTest.Data/WindowsInstallerTableDefinitionsFixture.cs | |||
@@ -0,0 +1,29 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Data | ||
4 | { | ||
5 | using WixToolset.Data.WindowsInstaller; | ||
6 | using Xunit; | ||
7 | |||
8 | public class WindowsInstallerTableDefinitionsFixture | ||
9 | { | ||
10 | [Fact] | ||
11 | public void CanCreateWindowsInstallerRows() | ||
12 | { | ||
13 | foreach (var tableDefinition in WindowsInstallerTableDefinitions.All) | ||
14 | { | ||
15 | var table = new Table(tableDefinition); | ||
16 | var rowFromTable = table.CreateRow(null); | ||
17 | var rowFromTableDefinition = tableDefinition.CreateRow(null); | ||
18 | var expectedRowTypeName = tableDefinition.Name.Replace("_", "") + "Row"; | ||
19 | var expectedRowType = rowFromTable.GetType(); | ||
20 | |||
21 | Assert.Equal(expectedRowType, rowFromTableDefinition.GetType()); | ||
22 | if (typeof(Row) != expectedRowType) | ||
23 | { | ||
24 | Assert.Equal(expectedRowTypeName, expectedRowType.Name); | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | } | ||