| 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 WixToolset.Data |
| 4 | { |
| 5 | using WixToolset.Data.Symbols; |
| 6 | |
| 7 | public static partial class SymbolDefinitions |
| 8 | { |
| 9 | public static readonly IntermediateSymbolDefinition WixSimpleReference = new IntermediateSymbolDefinition( |
| 10 | SymbolDefinitionType.WixSimpleReference, |
| 11 | new[] |
| 12 | { |
| 13 | new IntermediateFieldDefinition(nameof(WixSimpleReferenceSymbolFields.Table), IntermediateFieldType.String), |
| 14 | new IntermediateFieldDefinition(nameof(WixSimpleReferenceSymbolFields.PrimaryKeys), IntermediateFieldType.String), |
| 15 | }, |
| 16 | typeof(WixSimpleReferenceSymbol)); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | namespace WixToolset.Data.Symbols |
| 21 | { |
| 22 | using System; |
| 23 | using System.Diagnostics; |
| 24 | |
| 25 | public enum WixSimpleReferenceSymbolFields |
| 26 | { |
| 27 | Table, |
| 28 | PrimaryKeys, |
| 29 | } |
| 30 | |
| 31 | [DebuggerDisplay("Ref {SymbolicName,nq}")] |
| 32 | public class WixSimpleReferenceSymbol : IntermediateSymbol |
| 33 | { |
| 34 | public WixSimpleReferenceSymbol() : base(SymbolDefinitions.WixSimpleReference, null, null) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | public WixSimpleReferenceSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SymbolDefinitions.WixSimpleReference, sourceLineNumber, id) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | public IntermediateField this[WixSimpleReferenceSymbolFields index] => this.Fields[(int)index]; |
| 43 | |
| 44 | public string Table |
| 45 | { |
| 46 | get => (string)this.Fields[(int)WixSimpleReferenceSymbolFields.Table]; |
| 47 | set => this.Set((int)WixSimpleReferenceSymbolFields.Table, value); |
| 48 | } |
| 49 | |
| 50 | public string PrimaryKeys |
| 51 | { |
| 52 | get => (string)this.Fields[(int)WixSimpleReferenceSymbolFields.PrimaryKeys]; |
| 53 | set => this.Set((int)WixSimpleReferenceSymbolFields.PrimaryKeys, value); |
| 54 | } |
| 55 | |
| 56 | /// <summary> |
| 57 | /// Gets the symbolic name. |
| 58 | /// </summary> |
| 59 | /// <value>Symbolic name.</value> |
| 60 | public string SymbolicName => String.Concat(this.Table, ":", this.PrimaryKeys); |
| 61 | } |
| 62 | } |