Skip to content

Commit e65a007

Browse files
committed
Java and C# Code Snippets for 4.0.0 Beta 2
1 parent b64e9b9 commit e65a007

File tree

111 files changed

+8576
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+8576
-393
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,9 @@ dmypy.json
135135

136136
# Output folder used by examples
137137
resources/output/
138+
139+
csharp/snippets/**/bin
140+
csharp/snippets/**/obj
141+
csharp/runner/**/bin
142+
csharp/runner/**/obj
143+

csharp/README.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# C# Snippets
2+
3+
The C# snippets are contained in the `snippets` directory under various
4+
directories -- each as its own assembly/project.
5+
6+
## Building
7+
8+
The C# snippets can built using the `dotnet build [project-name]` command under each directory. They can be run using `dotnet run --project [project-name]` command. Attempting to run a snippet will also trigger building it.
9+
10+
## Running
11+
12+
There are several ways to run the code snippets.
13+
14+
### Run Directly
15+
16+
You may run any individual Snippet class directly providing you have a Senzing repository to run it with and the `SENZING_ENGINE_CONFIGURATION_JSON` environment variable set for connecting to that repository. Many of the snippets will find a default data file to run with if run from the `snippets` directory, but also allow the caller to use a different data file if given by the first command-line argument.
17+
18+
1. Run a snippet that takes no command-line arguments.
19+
20+
```[shell]
21+
cd snippets
22+
dotnet run --project loading/LoadRecords
23+
```
24+
25+
2. Run a snippet and override the input file using command-line arguments
26+
27+
```[shell]
28+
dotnet run --project loading/LoadRecordsViaLoop ../../resources/data/load-500-with-errors.jsonl
29+
```
30+
31+
### Run via Runner
32+
33+
The `SnippetRunner` project will run one or more snippets for you and create a temporary Senzing repository to run then against. This can be executed using:
34+
35+
```[shell]
36+
cd runner
37+
dotnet run --project SnippetRunner
38+
```
39+
40+
**NOTE:** When code snippets are run this way you cannot specify command-line arguments for individual snippets, nor can you respond to command-line input requests (they will be automatically be responded by the runner -- including forced termination of a snippet that is intended to run indefinitely).
41+
42+
1. Execute all code snippets:
43+
44+
```[shell]
45+
cd runner
46+
dotnet run --project SnippetRunner all
47+
```
48+
49+
2. Execute all code snippets in a group:
50+
51+
```[shell]
52+
cd runner
53+
dotnet run --project SnippetRunner loading
54+
```
55+
56+
3. Execute all code snippets from multiple groups:
57+
58+
```[shell]
59+
cd runner
60+
dotnet run --project SnippetRunner loading redo
61+
```
62+
63+
4. Execute specific code snippets:
64+
65+
```[shell]
66+
cd runner
67+
dotnet run --project SnippetRunner loading.LoadViaLoop loading.LoadViaQueue
68+
```
69+
70+
5. Mix and match packages with individual snippets:
71+
72+
```[shell]
73+
cd runner
74+
dotnet run --project SnippetRunner redo loading.LoadViaLoop
75+
```
76+
77+
6. Generate a help message by specifying no arguments:
78+
79+
```[shell]
80+
cd runner
81+
dotnet run --project SnippetRunner
82+
83+
dotnet run --project SnippetRunner [ all | <group> | <snippet> ]*
84+
85+
- Specifying no arguments will print this message
86+
- Specifying "all" will run all snippets
87+
- Specifying one or more groups will run all snippets in those groups
88+
- Specifying one or more snippets will run those snippet
89+
90+
Examples:
91+
92+
dotnet run --project SnippetRunner all
93+
94+
dotnet run --project SnippetRunner loading.LoadRecords loading.LoadViaFutures
95+
96+
dotnet run --project SnippetRunner initialization deleting loading.LoadRecords
97+
98+
Snippet Group Names:
99+
- configuration
100+
- deleting
101+
- information
102+
- initialization
103+
- loading
104+
- redo
105+
- searching
106+
- stewardship
107+
108+
Snippet Names:
109+
- configuration.AddDataSources
110+
- configuration.InitDefaultConfig
111+
- deleting.DeleteViaFutures
112+
- deleting.DeleteViaLoop
113+
- deleting.DeleteWithInfoViaFutures
114+
- information.CheckDatastorePerformance
115+
- information.GetDatastoreInfo
116+
- information.GetLicense
117+
- information.GetVersion
118+
- initialization.EnginePriming
119+
- initialization.EnvironmentAndHubs
120+
- initialization.PurgeRepository
121+
- loading.LoadRecords
122+
- loading.LoadTruthSetWithInfoViaLoop
123+
- loading.LoadViaFutures
124+
- loading.LoadViaLoop
125+
- loading.LoadViaQueue
126+
- loading.LoadWithInfoViaFutures
127+
- loading.LoadWithStatsViaLoop
128+
- redo.LoadWithRedoViaLoop
129+
- redo.RedoContinuous
130+
- redo.RedoContinuousViaFutures
131+
- redo.RedoWithInfoContinuous
132+
- searching.SearchRecords
133+
- searching.SearchViaFutures
134+
- stewardship.ForceResolve
135+
- stewardship.ForceUnresolve
136+
```

0 commit comments

Comments
 (0)