|
11 | 11 | string? settings = Environment.GetEnvironmentVariable("SENZING_ENGINE_CONFIGURATION_JSON"); |
12 | 12 | if (settings == null) |
13 | 13 | { |
14 | | - Console.Error.WriteLine("Unable to get settings."); |
15 | | - throw new ArgumentException("Unable to get settings"); |
| 14 | + Console.Error.WriteLine("Unable to get settings."); |
| 15 | + throw new ArgumentException("Unable to get settings"); |
16 | 16 | } |
17 | 17 |
|
18 | 18 | // create a descriptive instance name (can be anything) |
|
28 | 28 |
|
29 | 29 | try |
30 | 30 | { |
31 | | - // get the engine from the environment |
32 | | - SzEngine engine = env.GetEngine(); |
| 31 | + // get the engine from the environment |
| 32 | + SzEngine engine = env.GetEngine(); |
33 | 33 |
|
34 | | - // loop through the example records and add them to the repository |
35 | | - foreach (KeyValuePair<(string, string), string> pair in GetRecords()) |
36 | | - { |
37 | | - (string dataSourceCode, string recordID) = pair.Key; |
38 | | - string recordDefinition = pair.Value; |
| 34 | + // loop through the example records and add them to the repository |
| 35 | + foreach (KeyValuePair<(string, string), string> pair in GetRecords()) |
| 36 | + { |
| 37 | + (string dataSourceCode, string recordID) = pair.Key; |
| 38 | + string recordDefinition = pair.Value; |
39 | 39 |
|
40 | | - // call the addRecord() function with no flags |
41 | | - engine.AddRecord(dataSourceCode, recordID, recordDefinition, SzNoFlags); |
| 40 | + // call the addRecord() function with no flags |
| 41 | + engine.AddRecord(dataSourceCode, recordID, recordDefinition, SzNoFlags); |
42 | 42 |
|
43 | | - Console.WriteLine("Record " + recordID + " added"); |
44 | | - Console.Out.Flush(); |
45 | | - } |
| 43 | + Console.WriteLine("Record " + recordID + " added"); |
| 44 | + Console.Out.Flush(); |
| 45 | + } |
46 | 46 |
|
47 | 47 | } |
48 | 48 | catch (SzException e) |
49 | 49 | { |
50 | | - // handle any exception that may have occurred |
51 | | - Console.Error.WriteLine("Senzing Error Message : " + e.Message); |
52 | | - Console.Error.WriteLine("Senzing Error Code : " + e.ErrorCode); |
53 | | - Console.Error.WriteLine(e); |
54 | | - throw; |
| 50 | + // handle any exception that may have occurred |
| 51 | + Console.Error.WriteLine("Senzing Error Message : " + e.Message); |
| 52 | + Console.Error.WriteLine("Senzing Error Code : " + e.ErrorCode); |
| 53 | + Console.Error.WriteLine(e); |
| 54 | + throw; |
55 | 55 |
|
56 | 56 | } |
57 | 57 | catch (Exception e) |
58 | 58 | { |
59 | | - Console.Error.WriteLine(); |
60 | | - Console.Error.WriteLine("*** Terminated due to critical error ***"); |
61 | | - Console.Error.WriteLine(e); |
62 | | - Console.Error.Flush(); |
63 | | - throw; |
| 59 | + Console.Error.WriteLine(); |
| 60 | + Console.Error.WriteLine("*** Terminated due to critical error ***"); |
| 61 | + Console.Error.WriteLine(e); |
| 62 | + Console.Error.Flush(); |
| 63 | + throw; |
64 | 64 | } |
65 | 65 | finally |
66 | 66 | { |
67 | | - // IMPORTANT: make sure to destroy the environment |
68 | | - env.Destroy(); |
| 67 | + // IMPORTANT: make sure to destroy the environment |
| 68 | + env.Destroy(); |
69 | 69 | } |
70 | 70 |
|
71 | 71 | /// <summary> |
|
78 | 78 | /// </returns> |
79 | 79 | static IDictionary<(string, string), string> GetRecords() |
80 | 80 | { |
81 | | - IDictionary<(string, string), string> records |
82 | | - = new SortedDictionary<(string, string), string>(); |
| 81 | + IDictionary<(string, string), string> records |
| 82 | + = new SortedDictionary<(string, string), string>(); |
83 | 83 |
|
84 | | - records.Add( |
85 | | - ("TEST", "1001"), |
86 | | - """ |
| 84 | + records.Add( |
| 85 | + ("TEST", "1001"), |
| 86 | + """ |
87 | 87 | { |
88 | 88 | "DATA_SOURCE": "TEST", |
89 | 89 | "RECORD_ID": "1001", |
|
99 | 99 | } |
100 | 100 | """); |
101 | 101 |
|
102 | | - records.Add( |
103 | | - ("TEST", "1002"), |
104 | | - """ |
| 102 | + records.Add( |
| 103 | + ("TEST", "1002"), |
| 104 | + """ |
105 | 105 | { |
106 | 106 | "DATA_SOURCE": "TEST", |
107 | 107 | "RECORD_ID": "1002", |
|
120 | 120 | } |
121 | 121 | """); |
122 | 122 |
|
123 | | - records.Add( |
124 | | - ("TEST", "1003"), |
125 | | - """ |
| 123 | + records.Add( |
| 124 | + ("TEST", "1003"), |
| 125 | + """ |
126 | 126 | { |
127 | 127 | "DATA_SOURCE": "TEST", |
128 | 128 | "RECORD_ID": "1003", |
|
135 | 135 | } |
136 | 136 | """); |
137 | 137 |
|
138 | | - records.Add( |
139 | | - ("TEST", "1004"), |
140 | | - """ |
| 138 | + records.Add( |
| 139 | + ("TEST", "1004"), |
| 140 | + """ |
141 | 141 | { |
142 | 142 | "DATA_SOURCE": "TEST", |
143 | 143 | "RECORD_ID": "1004", |
|
153 | 153 | } |
154 | 154 | """); |
155 | 155 |
|
156 | | - records.Add( |
157 | | - ("TEST", "1005"), |
158 | | - """ |
| 156 | + records.Add( |
| 157 | + ("TEST", "1005"), |
| 158 | + """ |
159 | 159 | { |
160 | 160 | "DATA_SOURCE": "TEST", |
161 | 161 | "RECORD_ID": "1005", |
|
173 | 173 | } |
174 | 174 | """); |
175 | 175 |
|
176 | | - return records; |
| 176 | + return records; |
177 | 177 | } |
0 commit comments