Skip to content

Commit e22501f

Browse files
committed
Bug fix in RunDwhAutomation
- package upgrade - address unhandled exception when using free-format Json without an output name
1 parent cca52eb commit e22501f

File tree

5 files changed

+273
-22
lines changed

5 files changed

+273
-22
lines changed
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
44
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
55
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
11+
</dependentAssembly>
12+
<dependentAssembly>
13+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
14+
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
15+
</dependentAssembly>
16+
</assemblyBinding>
17+
</runtime>
618
</configuration>

ClassLibrary/DataWarehouseAutomation/RunDwhAutomation/FodyWeavers.xsd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
1818
</xs:annotation>
1919
</xs:element>
20+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
21+
<xs:annotation>
22+
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
23+
</xs:annotation>
24+
</xs:element>
25+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
26+
<xs:annotation>
27+
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
28+
</xs:annotation>
29+
</xs:element>
2030
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
2131
<xs:annotation>
2232
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
@@ -43,6 +53,16 @@
4353
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
4454
</xs:annotation>
4555
</xs:attribute>
56+
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
57+
<xs:annotation>
58+
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
59+
</xs:annotation>
60+
</xs:attribute>
61+
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
62+
<xs:annotation>
63+
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
64+
</xs:annotation>
65+
</xs:attribute>
4666
<xs:attribute name="DisableCompression" type="xs:boolean">
4767
<xs:annotation>
4868
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
@@ -73,6 +93,16 @@
7393
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
7494
</xs:annotation>
7595
</xs:attribute>
96+
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
97+
<xs:annotation>
98+
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
99+
</xs:annotation>
100+
</xs:attribute>
101+
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
102+
<xs:annotation>
103+
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
104+
</xs:annotation>
105+
</xs:attribute>
76106
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
77107
<xs:annotation>
78108
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>

ClassLibrary/DataWarehouseAutomation/RunDwhAutomation/Program.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ static int Main(string[] args)
1717
#region unit testing
1818
// Unit testing only.
1919
//var testArgs = new string[]
20-
//{
21-
// // "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\sampleBasic.json"
22-
// "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\"
23-
// ,"-p", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Templates\TemplateSampleBasic.Handlebars"
20+
//{ "-i", @"D:\Git_Repos\TEAM\TEAM\bin\Debug\Output\"
21+
// ,"-p", @"D:\Git_Repos\Data_Warehouse_Automation_Metadata_Interface\ClassLibrary\DataWarehouseAutomation\Sample_Templates\TemplateSatelliteView.Handlebars"
2422
// ,"-o"
25-
// ,"-d", @"C:\Files\"
23+
// ,"-d", @"D:\Workspace"
2624
// ,"-e", "sql"
27-
// ,"-f", "roelant"
25+
// //,"-f", "roelant"
2826
// ,"-v"
2927
//};
3028

@@ -40,6 +38,7 @@ static int Main(string[] args)
4038
#endregion
4139

4240
CommandLineArgumentHelper environmentHelper = new CommandLineArgumentHelper();
41+
//CommandLineArgumentHelper environmentHelper = new CommandLineArgumentHelper(testArgs);
4342
string[] localArgs = environmentHelper.args;
4443

4544
Parser.Default.ParseArguments<Options>(localArgs).WithParsed(options =>
@@ -105,10 +104,12 @@ static int Main(string[] args)
105104
{
106105
if (options.outputFileName == null)
107106
{
107+
// The outputfilename will be derived from the Json input (mappingName), if available.
108108
RunAutomation(options, file);
109109
}
110110
else
111111
{
112+
// The output file name is concatenated as the specified file and a file number to ensure uniqueness.
112113
RunAutomation(options, file, options.outputFileName + Array.IndexOf(localFiles, file));
113114
}
114115
}
@@ -165,7 +166,19 @@ private static void RunAutomation(Options options, string inputFileName, string
165166
if (outputFileName == "")
166167
{
167168
//outputFileName = deserialisedMapping.dataObjectMappings[0].mappingName; // you could read this from the free form mapping file, too
168-
outputFileName = (string)freeFormMapping["mappingName"]; // you could read this from the free form mapping file, too
169+
try
170+
{
171+
outputFileName = (string) freeFormMapping["dataObjectMappings"][0]["mappingName"];
172+
}
173+
catch
174+
{
175+
outputFileName = Path.GetFileNameWithoutExtension(inputFileName) + '_' +DateTime.Now.ToString("yyyyMMddHHmmss");
176+
177+
if (options.verbose)
178+
{
179+
Console.WriteLine($"The standard 'mappingName' segment was not found where expected, so the file name has been defaulted to {outputFileName}.");
180+
}
181+
}
169182
}
170183

171184
Console.WriteLine($"Generating {outputFileName}.{options.outputFileExtension} to {options.outputDirectory}.");

0 commit comments

Comments
 (0)