summaryrefslogtreecommitdiff
path: root/src/TablesAndTuples/WixTableDefinition.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/TablesAndTuples/WixTableDefinition.cs')
-rw-r--r--src/TablesAndTuples/WixTableDefinition.cs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/TablesAndTuples/WixTableDefinition.cs b/src/TablesAndTuples/WixTableDefinition.cs
index a826a174..61dcbb0a 100644
--- a/src/TablesAndTuples/WixTableDefinition.cs
+++ b/src/TablesAndTuples/WixTableDefinition.cs
@@ -2,43 +2,43 @@ using System.Collections.Generic;
2using System.Linq; 2using System.Linq;
3using System.Xml; 3using System.Xml;
4 4
5namespace TablesAndTuples 5namespace TablesAndSymbols
6{ 6{
7 class WixTableDefinition 7 class WixTableDefinition
8 { 8 {
9 public WixTableDefinition(string name, IEnumerable<WixColumnDefinition> columns, bool unreal, bool tupleless, string tupleDefinitionName, bool? tupleIdIsPrimaryKey) 9 public WixTableDefinition(string name, IEnumerable<WixColumnDefinition> columns, bool unreal, bool symbolless, string symbolDefinitionName, bool? symbolIdIsPrimaryKey)
10 { 10 {
11 this.Name = name; 11 this.Name = name;
12 this.VariableName = name.Replace("_", ""); 12 this.VariableName = name.Replace("_", "");
13 this.Unreal = unreal; 13 this.Unreal = unreal;
14 this.Columns = columns?.ToArray(); 14 this.Columns = columns?.ToArray();
15 this.Tupleless = tupleless; 15 this.Symbolless = symbolless;
16 this.TupleDefinitionName = tupleless ? null : tupleDefinitionName ?? this.VariableName; 16 this.SymbolDefinitionName = symbolless ? null : symbolDefinitionName ?? this.VariableName;
17 this.TupleIdIsPrimaryKey = tupleIdIsPrimaryKey ?? DeriveTupleIdIsPrimaryKey(this.Columns); 17 this.SymbolIdIsPrimaryKey = symbolIdIsPrimaryKey ?? DeriveSymbolIdIsPrimaryKey(this.Columns);
18 } 18 }
19 19
20 public string Name { get; } 20 public string Name { get; }
21 21
22 public string VariableName { get; } 22 public string VariableName { get; }
23 23
24 public string TupleDefinitionName { get; } 24 public string SymbolDefinitionName { get; }
25 25
26 public bool Unreal { get; } 26 public bool Unreal { get; }
27 27
28 public WixColumnDefinition[] Columns { get; } 28 public WixColumnDefinition[] Columns { get; }
29 29
30 public bool TupleIdIsPrimaryKey { get; } 30 public bool SymbolIdIsPrimaryKey { get; }
31 31
32 public bool Tupleless { get; } 32 public bool Symbolless { get; }
33 33
34 static WixTableDefinition Read(XmlReader reader) 34 static WixTableDefinition Read(XmlReader reader)
35 { 35 {
36 var empty = reader.IsEmptyElement; 36 var empty = reader.IsEmptyElement;
37 string name = null; 37 string name = null;
38 string tupleDefinitionName = null; 38 string symbolDefinitionName = null;
39 var unreal = false; 39 var unreal = false;
40 bool? tupleIdIsPrimaryKey = null; 40 bool? symbolIdIsPrimaryKey = null;
41 var tupleless = false; 41 var symbolless = false;
42 42
43 while (reader.MoveToNextAttribute()) 43 while (reader.MoveToNextAttribute())
44 { 44 {
@@ -47,14 +47,14 @@ namespace TablesAndTuples
47 case "name": 47 case "name":
48 name = reader.Value; 48 name = reader.Value;
49 break; 49 break;
50 case "tupleDefinitionName": 50 case "symbolDefinitionName":
51 tupleDefinitionName = reader.Value; 51 symbolDefinitionName = reader.Value;
52 break; 52 break;
53 case "tupleIdIsPrimaryKey": 53 case "symbolIdIsPrimaryKey":
54 tupleIdIsPrimaryKey = reader.Value.Equals("yes"); 54 symbolIdIsPrimaryKey = reader.Value.Equals("yes");
55 break; 55 break;
56 case "tupleless": 56 case "symbolless":
57 tupleless = reader.Value.Equals("yes"); 57 symbolless = reader.Value.Equals("yes");
58 break; 58 break;
59 case "unreal": 59 case "unreal":
60 unreal = reader.Value.Equals("yes"); 60 unreal = reader.Value.Equals("yes");
@@ -101,10 +101,10 @@ namespace TablesAndTuples
101 } 101 }
102 } 102 }
103 103
104 return new WixTableDefinition(name, columns.ToArray(), unreal, tupleless, tupleDefinitionName, tupleIdIsPrimaryKey); 104 return new WixTableDefinition(name, columns.ToArray(), unreal, symbolless, symbolDefinitionName, symbolIdIsPrimaryKey);
105 } 105 }
106 106
107 static bool DeriveTupleIdIsPrimaryKey(WixColumnDefinition[] columns) 107 static bool DeriveSymbolIdIsPrimaryKey(WixColumnDefinition[] columns)
108 { 108 {
109 return columns[0].PrimaryKey && 109 return columns[0].PrimaryKey &&
110 columns[0].Type == ColumnType.String && 110 columns[0].Type == ColumnType.String &&