|
10 | 10 | // get the senzing repository settings |
11 | 11 | string? settings = Environment.GetEnvironmentVariable("SENZING_ENGINE_CONFIGURATION_JSON"); |
12 | 12 | if (settings == null) |
13 | | -{ |
14 | | - Console.Error.WriteLine("Unable to get settings."); |
| 13 | +{ |
| 14 | + Console.Error.WriteLine("Unable to get settings."); |
15 | 15 | throw new ArgumentException("Unable to get settings"); |
16 | 16 | } |
17 | 17 |
|
|
27 | 27 | .Build(); |
28 | 28 |
|
29 | 29 | try |
30 | | -{ |
31 | | - // get the engine from the environment |
32 | | - SzEngine engine = env.GetEngine(); |
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; |
39 | | - |
40 | | - // call the addRecord() function with no flags |
41 | | - engine.AddRecord(dataSourceCode, recordID, recordDefinition, SzNoFlags); |
42 | | - |
43 | | - Console.WriteLine("Record " + recordID + " added"); |
44 | | - Console.Out.Flush(); |
| 30 | +{ |
| 31 | + // get the engine from the environment |
| 32 | + SzEngine engine = env.GetEngine(); |
| 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; |
| 39 | + |
| 40 | + // call the addRecord() function with no flags |
| 41 | + engine.AddRecord(dataSourceCode, recordID, recordDefinition, SzNoFlags); |
| 42 | + |
| 43 | + Console.WriteLine("Record " + recordID + " added"); |
| 44 | + Console.Out.Flush(); |
45 | 45 | } |
46 | 46 |
|
47 | 47 | } |
48 | 48 | catch (SzException e) |
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); |
| 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 | 54 | throw; |
55 | 55 |
|
56 | 56 | } |
57 | 57 | catch (Exception e) |
58 | | -{ |
59 | | - Console.Error.WriteLine(); |
60 | | - Console.Error.WriteLine("*** Terminated due to critical error ***"); |
61 | | - Console.Error.WriteLine(e); |
62 | | - Console.Error.Flush(); |
| 58 | +{ |
| 59 | + Console.Error.WriteLine(); |
| 60 | + Console.Error.WriteLine("*** Terminated due to critical error ***"); |
| 61 | + Console.Error.WriteLine(e); |
| 62 | + Console.Error.Flush(); |
63 | 63 | throw; |
64 | 64 | } |
65 | 65 | finally |
66 | | -{ |
67 | | - // IMPORTANT: make sure to destroy the environment |
| 66 | +{ |
| 67 | + // IMPORTANT: make sure to destroy the environment |
68 | 68 | env.Destroy(); |
69 | 69 | } |
70 | 70 |
|
|
77 | 77 | /// to <c>string</c> JSON text values describing the records to be added. |
78 | 78 | /// </returns> |
79 | 79 | static IDictionary<(string, string), string> GetRecords() |
80 | | -{ |
81 | | - IDictionary<(string, string), string> records |
82 | | - = new SortedDictionary<(string, string), string>(); |
83 | | - |
84 | | - records.Add( |
85 | | - ("TEST", "1001"), |
| 80 | +{ |
| 81 | + IDictionary<(string, string), string> records |
| 82 | + = new SortedDictionary<(string, string), string>(); |
| 83 | + |
| 84 | + records.Add( |
| 85 | + ("TEST", "1001"), |
86 | 86 | """ |
87 | 87 | { |
88 | 88 | "DATA_SOURCE": "TEST", |
|
97 | 97 | "PHONE_NUMBER": "702-919-1300", |
98 | 98 | "EMAIL_ADDRESS": "[email protected]" |
99 | 99 | } |
100 | | - """); |
101 | | - |
102 | | - records.Add( |
103 | | - ("TEST", "1002"), |
| 100 | + """); |
| 101 | + |
| 102 | + records.Add( |
| 103 | + ("TEST", "1002"), |
104 | 104 | """ |
105 | 105 | { |
106 | 106 | "DATA_SOURCE": "TEST", |
|
118 | 118 | "PHONE_TYPE": "MOBILE", |
119 | 119 | "PHONE_NUMBER": "702-919-1300" |
120 | 120 | } |
121 | | - """); |
122 | | - |
123 | | - records.Add( |
124 | | - ("TEST", "1003"), |
| 121 | + """); |
| 122 | + |
| 123 | + records.Add( |
| 124 | + ("TEST", "1003"), |
125 | 125 | """ |
126 | 126 | { |
127 | 127 | "DATA_SOURCE": "TEST", |
|
133 | 133 | "DATE_OF_BIRTH": "12/11/1978", |
134 | 134 | "EMAIL_ADDRESS": "[email protected]" |
135 | 135 | } |
136 | | - """); |
137 | | - |
138 | | - records.Add( |
139 | | - ("TEST", "1004"), |
| 136 | + """); |
| 137 | + |
| 138 | + records.Add( |
| 139 | + ("TEST", "1004"), |
140 | 140 | """ |
141 | 141 | { |
142 | 142 | "DATA_SOURCE": "TEST", |
|
151 | 151 | "ADDR_POSTAL_CODE": "89132", |
152 | 152 | "EMAIL_ADDRESS": "[email protected]" |
153 | 153 | } |
154 | | - """); |
155 | | - |
156 | | - records.Add( |
157 | | - ("TEST", "1005"), |
| 154 | + """); |
| 155 | + |
| 156 | + records.Add( |
| 157 | + ("TEST", "1005"), |
158 | 158 | """ |
159 | 159 | { |
160 | 160 | "DATA_SOURCE": "TEST", |
|
171 | 171 | "ADDR_STATE": "NV", |
172 | 172 | "ADDR_POSTAL_CODE": "89132" |
173 | 173 | } |
174 | | - """); |
175 | | - |
| 174 | + """); |
| 175 | + |
176 | 176 | return records; |
177 | 177 | } |
0 commit comments