From a6091afa5bd24fe65e7fc20f179ed888301afdf8 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 18 Apr 2020 14:43:31 +1000 Subject: Test ability for an extension to have a custom strongly typed row during binding. --- .../ExampleWindowsInstallerBackendExtension.cs | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs') diff --git a/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs index 4ee682d3..2818cde4 100644 --- a/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs +++ b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs @@ -13,22 +13,21 @@ namespace Example.Extension public override bool TryAddTupleToOutput(IntermediateSection section, IntermediateTuple tuple, WindowsInstallerData output, TableDefinitionCollection tableDefinitions) { -#if ALTERNATIVE_TO_USING_HELPER - switch (tuple.Definition.Name) + if (ExampleTupleDefinitions.TryGetTupleType(tuple.Definition.Name, out var tupleType)) { - case ExampleTupleDefinitions.ExampleName: - { - var row = this.BackendHelper.CreateRow(section, tuple, output, ExampleTableDefinitions.ExampleTable); - row[0] = tuple[0].AsString(); - row[1] = tuple[1].AsString(); - } - return true; + switch (tupleType) + { + case ExampleTupleDefinitionType.Example: + { + var row = (ExampleRow)this.BackendHelper.CreateRow(section, tuple, output, ExampleTableDefinitions.ExampleTable); + row.Example = tuple.Id.Id; + row.Value = tuple[0].AsString(); + } + return true; + } } - return false; -#else return this.BackendHelper.TryAddTupleToOutputMatchingTableDefinitions(section, tuple, output, tableDefinitions); -#endif } } } -- cgit v1.2.3-55-g6feb