Skip to content

Commit 9cd8652

Browse files
committed
Merge branch 'main' into 24-skern
2 parents bd02a01 + c717459 commit 9cd8652

File tree

36 files changed

+99
-177
lines changed

36 files changed

+99
-177
lines changed

csharp/runner/SnippetRunner/Program.cs

+12-29
Original file line numberDiff line numberDiff line change
@@ -246,35 +246,21 @@ SortedDictionary<string, SortedDictionary<string, string>> snippetsMap
246246
// check if we need to configure sources
247247
if (properties.ContainsKey(SourceKeyPrefix + 0))
248248
{
249-
SzConfig config = env.GetConfig();
250-
IntPtr handle = config.CreateConfig();
251-
string? snippetConfig = null;
252-
try
249+
SzConfig config = configMgr.CreateConfig();
250+
for (int index = 0;
251+
properties.ContainsKey(SourceKeyPrefix + index);
252+
index++)
253253
{
254-
for (int index = 0;
255-
properties.ContainsKey(SourceKeyPrefix + index);
256-
index++)
257-
{
258-
string sourceKey = SourceKeyPrefix + index;
259-
string source = properties[sourceKey];
260-
source = source.Trim();
261-
Console.WriteLine("Adding data source: " + source);
262-
config.AddDataSource(handle, source);
263-
}
264-
snippetConfig = config.ExportConfig(handle);
265-
266-
}
267-
finally
268-
{
269-
config.CloseConfig(handle);
254+
string sourceKey = SourceKeyPrefix + index;
255+
string source = properties[sourceKey];
256+
source = source.Trim();
257+
Console.WriteLine("Adding data source: " + source);
258+
config.AddDataSource(source);
270259
}
260+
string snippetConfig = config.Export();
271261

272262
// register the config
273-
long configID = configMgr.AddConfig(snippetConfig, snippet);
274-
275-
// set the default config to the snippet config
276-
configMgr.SetDefaultConfigID(configID);
277-
263+
configMgr.SetDefaultConfig(snippetConfig);
278264
}
279265
else
280266
{
@@ -657,10 +643,7 @@ static string SetupTempRepository(InstallLocations senzingInstall)
657643
SzEnvironment env = SzCoreEnvironment.NewBuilder().Settings(settings).Build();
658644
try
659645
{
660-
SzConfigManager configMgr = env.GetConfigManager();
661-
662-
long configID = configMgr.AddConfig(baseConfig, "Default Config");
663-
configMgr.SetDefaultConfigID(configID);
646+
env.GetConfigManager().SetDefaultConfig(baseConfig);
664647

665648
}
666649
catch (Exception)

csharp/runner/SnippetRunner/SnippetRunner.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.1" />
16-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
16+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

csharp/snippets/configuration/AddDataSources/AddDataSources.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/configuration/AddDataSources/Program.cs

+14-25
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828

2929
try
3030
{
31-
// get the config and config manager from the environment
32-
SzConfig config = env.GetConfig();
31+
// get the config manager from the environment
3332
SzConfigManager configMgr = env.GetConfigManager();
3433

3534
// setup a loop to handle race-condition conflicts on
@@ -39,35 +38,25 @@
3938
{
4039
// get the current default config ID and associated config JSON
4140
long configID = configMgr.GetDefaultConfigID();
42-
string configDefinition = configMgr.GetConfig(configID);
4341

44-
// prepare an in-memory config to be modified and get the handle
45-
IntPtr configHandle = config.ImportConfig(configDefinition);
46-
string? modifiedConfig = null;
47-
try
48-
{
49-
// create an array of the data sources to add
50-
string[] dataSources = { "CUSTOMERS", "EMPLOYEES", "WATCHLIST" };
51-
52-
// loop through the array and add each data source
53-
foreach (string dataSource in dataSources)
54-
{
55-
config.AddDataSource(configHandle, dataSource);
56-
}
57-
58-
// export the modified config to JSON text
59-
modifiedConfig = config.ExportConfig(configHandle);
42+
// get the SzConfig for the config ID
43+
SzConfig config = configMgr.CreateConfig(configID);
44+
45+
// create an array of the data sources to add
46+
string[] dataSources = { "CUSTOMERS", "EMPLOYEES", "WATCHLIST" };
6047

61-
}
62-
finally
48+
// loop through the array and add each data source
49+
foreach (string dataSource in dataSources)
6350
{
64-
config.CloseConfig(configHandle);
51+
config.AddDataSource(dataSource);
6552
}
6653

67-
// add the modified config to the repository with a comment
68-
long newConfigID = configMgr.AddConfig(
69-
modifiedConfig, "Added truth set data sources");
54+
// prepare an in-memory config to be modified and get the handle
55+
string modifiedConfig = config.Export();
7056

57+
// add the modified config to the repository with a comment
58+
long newConfigID = configMgr.RegisterConfig(modifiedConfig);
59+
7160
try
7261
{
7362
// replace the default config

csharp/snippets/configuration/InitDefaultConfig/InitDefaultConfig.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/configuration/InitDefaultConfig/Program.cs

+6-20
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,16 @@
2828

2929
try
3030
{
31-
// get the config and config manager from the environment
32-
SzConfig config = env.GetConfig();
31+
// get the config and config from the environment
3332
SzConfigManager configMgr = env.GetConfigManager();
3433

35-
// prepare an in-memory config to be modified and get the handle
36-
IntPtr configHandle = config.CreateConfig();
37-
string? configDefinition = null;
38-
39-
try
40-
{
41-
configDefinition = config.ExportConfig(configHandle);
42-
43-
}
44-
finally
45-
{
46-
config.CloseConfig(configHandle);
47-
}
34+
// prepare a config to be modified
35+
SzConfig config = configMgr.CreateConfig();
36+
string configDefinition = config.Export();
4837

4938
// add the modified config to the repository with a comment
50-
long configID = configMgr.AddConfig(
51-
configDefinition, "Initial configuration");
52-
53-
// replace the default config
54-
configMgr.SetDefaultConfigID(configID);
39+
configMgr.SetDefaultConfig(configDefinition);
40+
5541
}
5642
catch (SzException e)
5743
{

csharp/snippets/deleting/DeleteViaFutures/DeleteViaFutures.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/deleting/DeleteViaLoop/DeleteViaLoop.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/deleting/DeleteWithInfoViaFutures/DeleteWithInfoViaFutures.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/information/CheckDatastorePerformance/CheckDatastorePerformance.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/information/GetDatastoreInfo/GetDatastoreInfo.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/information/GetLicense/GetLicense.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/information/GetVersion/GetVersion.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/initialization/EnginePriming/EnginePriming.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/initialization/EnvironmentAndHubs/EnvironmentAndHubs.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/initialization/EnvironmentAndHubs/Program.cs

-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
try
3030
{
3131
SzProduct product = env.GetProduct();
32-
SzConfig config = env.GetConfig();
3332
SzConfigManager configMgr = env.GetConfigManager();
3433
SzDiagnostic diagnostic = env.GetDiagnostic();
3534
SzEngine engine = env.GetEngine();
3635

3736
Console.WriteLine(product);
38-
Console.WriteLine(config);
3937
Console.WriteLine(configMgr);
4038
Console.WriteLine(diagnostic);
4139
Console.WriteLine(engine);

csharp/snippets/initialization/PurgeRepository/PurgeRepository.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadRecords/LoadRecords.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadTruthSetWithInfoViaLoop/LoadTruthSetWithInfoViaLoop.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadViaFutures/LoadViaFutures.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadViaLoop/LoadViaLoop.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadViaQueue/LoadViaQueue.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadWithInfoViaFutures/LoadWithInfoViaFutures.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/loading/LoadWithStatsViaLoop/LoadWithStatsViaLoop.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/redo/LoadWithRedoViaLoop/LoadWithRedoViaLoop.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/redo/RedoContinuous/RedoContinuous.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/redo/RedoContinuousViaFutures/RedoContinuousViaFutures.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/redo/RedoWithInfoContinuous/RedoWithInfoContinuous.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

csharp/snippets/searching/SearchRecords/SearchRecords.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta.2.0" />
15+
<PackageReference Include="Senzing.Sdk" Version="4.0.0-beta*" />
1616
</ItemGroup>
1717

1818
</Project>

0 commit comments

Comments
 (0)