Skip to content

Commit 1661b43

Browse files
authored
Updated redo snippets to avoid extensive calling of countRedoRecords() (#86)
1 parent 1ab255e commit 1661b43

File tree

16 files changed

+2764
-2759
lines changed

16 files changed

+2764
-2759
lines changed

csharp/runner/SnippetRunner/Program.cs

Lines changed: 558 additions & 558 deletions
Large diffs are not rendered by default.

csharp/snippets/deleting/DeleteViaFutures/Program.cs

Lines changed: 244 additions & 244 deletions
Large diffs are not rendered by default.

csharp/snippets/loading/LoadRecords/Program.cs

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
// get the senzing repository settings
1111
string? settings = Environment.GetEnvironmentVariable("SENZING_ENGINE_CONFIGURATION_JSON");
1212
if (settings == null)
13-
{
14-
Console.Error.WriteLine("Unable to get settings.");
13+
{
14+
Console.Error.WriteLine("Unable to get settings.");
1515
throw new ArgumentException("Unable to get settings");
1616
}
1717

@@ -27,44 +27,44 @@
2727
.Build();
2828

2929
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();
4545
}
4646

4747
}
4848
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);
5454
throw;
5555

5656
}
5757
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();
6363
throw;
6464
}
6565
finally
66-
{
67-
// IMPORTANT: make sure to destroy the environment
66+
{
67+
// IMPORTANT: make sure to destroy the environment
6868
env.Destroy();
6969
}
7070

@@ -77,12 +77,12 @@
7777
/// to <c>string</c> JSON text values describing the records to be added.
7878
/// </returns>
7979
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"),
8686
"""
8787
{
8888
"DATA_SOURCE": "TEST",
@@ -97,10 +97,10 @@
9797
"PHONE_NUMBER": "702-919-1300",
9898
"EMAIL_ADDRESS": "[email protected]"
9999
}
100-
""");
101-
102-
records.Add(
103-
("TEST", "1002"),
100+
""");
101+
102+
records.Add(
103+
("TEST", "1002"),
104104
"""
105105
{
106106
"DATA_SOURCE": "TEST",
@@ -118,10 +118,10 @@
118118
"PHONE_TYPE": "MOBILE",
119119
"PHONE_NUMBER": "702-919-1300"
120120
}
121-
""");
122-
123-
records.Add(
124-
("TEST", "1003"),
121+
""");
122+
123+
records.Add(
124+
("TEST", "1003"),
125125
"""
126126
{
127127
"DATA_SOURCE": "TEST",
@@ -133,10 +133,10 @@
133133
"DATE_OF_BIRTH": "12/11/1978",
134134
"EMAIL_ADDRESS": "[email protected]"
135135
}
136-
""");
137-
138-
records.Add(
139-
("TEST", "1004"),
136+
""");
137+
138+
records.Add(
139+
("TEST", "1004"),
140140
"""
141141
{
142142
"DATA_SOURCE": "TEST",
@@ -151,10 +151,10 @@
151151
"ADDR_POSTAL_CODE": "89132",
152152
"EMAIL_ADDRESS": "[email protected]"
153153
}
154-
""");
155-
156-
records.Add(
157-
("TEST", "1005"),
154+
""");
155+
156+
records.Add(
157+
("TEST", "1005"),
158158
"""
159159
{
160160
"DATA_SOURCE": "TEST",
@@ -171,7 +171,7 @@
171171
"ADDR_STATE": "NV",
172172
"ADDR_POSTAL_CODE": "89132"
173173
}
174-
""");
175-
174+
""");
175+
176176
return records;
177177
}

0 commit comments

Comments
 (0)