Skip to content

Commit f520dc4

Browse files
authored
Updates to docs excluding event driven content (#228)
* Updates to docs excluding event driven content * Updates for PR #228 --------- Co-authored-by: Israel Slobodkin Co-authored-by: chullybun
1 parent ea85271 commit f520dc4

11 files changed

+328
-126
lines changed

Diff for: samples/MyEf.Hr/README.md

+13-45
Original file line numberDiff line numberDiff line change
@@ -59,40 +59,7 @@ Endpoint | Description
5959
`DELETE /reviews/id` | Delete an existing review.
6060
`GET /employee/id/reviews` | Gets all review(s) for the employee (with paging support).
6161

62-
</br>
63-
64-
## Solution skeleton
65-
66-
This solution should be created using the solution [template](../../templates/Beef.Template.Solution/README.md) capability, following the getting started [guide](../../docs/Sample-SqlServer-EF-GettingStarted.md).
67-
68-
The following four commands should be invoked to create the solution structure. Start in a folder where the solution should reside. To simplify the ongoing copy and paste activities within this sample it is _highly recommended_ that the `MyEf.Hr` naming convention below is used.
69-
70-
```
71-
dotnet new install beef.template.solution --nuget-source https://api.nuget.org/v3/index.json
72-
mkdir MyEf.Hr
73-
cd MyEf.Hr
74-
dotnet new beef --company MyEf --appname Hr --datasource SqlServer
75-
```
76-
77-
The following solution structure will have been generated. Open `MyEf.Hr.sln` in Visual Studio.
78-
79-
```
80-
└── MyEf.Hr # Solution that references all underlying projects
81-
└── Testing
82-
└── MyEf.Hr.Test # Unit and intra-integration tests
83-
└── Tools
84-
└── MyEf.Hr.CodeGen # Entity and Reference Data code generation console
85-
└── MyEf.Hr.Database # Database code generation console
86-
└── MyEf.Hr.Api # API end-point and operations
87-
└── MyEf.Hr.Business # Core business logic components
88-
└── MyEf.Hr.Common # Common / shared components
89-
```
90-
91-
_Note:_ Code generation should **not** be performed before updating the corresponding YAML files as described in the next sections. Otherwise, extraneous files will be generated that will then need to be manually removed.
92-
93-
Also, any files that start with `Person` (being the demonstration entity) should be removed (deleted) from their respective projects as they are encountered. This then represents the baseline to build up the solution from.
94-
95-
</br>
62+
<br/>
9663

9764
## Railway-oriented programming
9865

@@ -102,20 +69,21 @@ The [`Result`](https://github.com/Avanade/CoreEx/blob/main/src/CoreEx/Results/Re
10269

10370
<br/>
10471

105-
## Implementation steps
72+
## Core Implementation steps
10673

10774
As described earlier, this sample will walk through the implementation in a number of logical steps:
10875

109-
1. [Employee DB](./docs/Employee-DB.md) - creates the `Employee` database table and related entity framework capabilities.
110-
2. [Employee API](./docs/Employee-Api.md) - creates the `Employee` entities, API and related data access logic.
111-
3. [Employee Test](./docs/Employee-Test.md) - creates the `Employee` end-to-end integration tests to validate the API and database functionality.
112-
4. [Employee Search](./docs/Employee-Search.md) - adds the `Employee` search capability and tests.
113-
5. [Employee Terminate](./docs/Employee-Terminate.md) - adds the `Employee` termination capability and tests.
114-
6. [Employee Performance Review](./docs/Performance-Review.md) - adds the employee `PerformanceReview` capability end-to-end, from the the database, through the APIs and corresponding testing.
76+
1. [Solution Skeleton](./docs/1-Solution-Skeleton.md) - start by creating a VS solution from Beef template
77+
2. [Employee DB](./docs/2-Employee-DB.md) - creates the `Employee` database table and related entity framework capabilities.
78+
3. [Employee API](./docs/3-Employee-Api.md) - creates the `Employee` entities, API and related data access logic.
79+
4. [Employee Test](./docs/4-Employee-Test.md) - creates the `Employee` end-to-end integration tests to validate the API and database functionality.
80+
5. [Employee Search](./docs/5-Employee-Search.md) - adds the `Employee` search capability and tests.
81+
6. [Employee Terminate](./docs/6-Employee-Terminate.md) - adds the `Employee` termination capability and tests.
82+
7. [Employee Performance Review](./docs/7-Performance-Review.md) - adds the employee `PerformanceReview` capability end-to-end, from the the database, through the APIs and corresponding testing.
11583

11684
<br/>
11785

118-
## Event driven architecture implementation
86+
## Event Driven Architecture implementation
11987

12088
The implementation so far has created the API capabilities to perform operations on the data as originally defined in the [scope](#Scope). This section can be [skipped](#Conclusion) where the related Event-driven architecture capabilities are not required.
12189

@@ -147,9 +115,9 @@ The _HR_ and _Security_ domains are completely decoupled from each other; in tha
147115

148116
This _EDA_ sample will walk through the implementation in a number of logical steps (these describe the integration of the _CoreEx_ capabilities to enable) to achieve the end-to-end Employee's User Account deactivation:
149117

150-
7. [Transactional Outbox](./docs/Transactional-Outbox.md) - enqueue events into the database.
151-
8. [Service Bus Publish](./docs/Service-Bus-Publish.md) - dequeue events (relay) from database publishing to Azure Service Bus.
152-
9. [Service Bus Subscribe](./docs/Service-Bus-Subscribe.md) - simulate an additional domain subscribing to an event (from Azure Service Bus).
118+
8. [Transactional Outbox](./docs/8-Transactional-Outbox.md) - enqueue events into the database.
119+
9. [Service Bus Publish](./docs/9-Service-Bus-Publish.md) - dequeue events (relay) from database publishing to Azure Service Bus.
120+
10. [Service Bus Subscribe](./docs/10-Service-Bus-Subscribe.md) - simulate an additional domain subscribing to an event (from Azure Service Bus).
153121

154122
<br/>
155123

Diff for: samples/MyEf.Hr/docs/1-Solution-Skeleton.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Step 1 - Solution Skeleton
2+
3+
The starting point of any solution built on top of Beef is to first create the Visual Studio solution skeleton, utilizing the solution [template](../../templates/Beef.Template.Solution/README.md).
4+
5+
*To simplify the ongoing copy and paste activities within this sample it is highly recommended that the `MyEf.Hr` naming convention below is used.*
6+
7+
Open a development terminal, navigate to an appropriate parent folder and execute the following four commands to create the solution structure.
8+
9+
```
10+
dotnet new install beef.template.solution --nuget-source https://api.nuget.org/v3/index.json
11+
mkdir MyEf.Hr
12+
cd MyEf.Hr
13+
dotnet new beef --company MyEf --appname Hr --datasource SqlServer
14+
```
15+
16+
The following solution structure will have been generated. Execute `.\MyEf.Hr.sln` to open in Visual Studio.
17+
18+
```
19+
└── MyEf.Hr # Solution that references all underlying projects
20+
└── Testing
21+
└── MyEf.Hr.Test # Unit and intra-integration tests
22+
└── Tools
23+
└── MyEf.Hr.CodeGen # Entity and Reference Data code generation console
24+
└── MyEf.Hr.Database # Database code generation console
25+
└── MyEf.Hr.Api # API end-point and operations
26+
└── MyEf.Hr.Business # Core business logic components
27+
└── MyEf.Hr.Common # Common / shared components
28+
```
29+
<br/>
30+
31+
## Important Notes
32+
Code generation should **not** be performed before updating the corresponding YAML files as described in the next sections. Otherwise, extraneous files will be generated that will then need to be manually removed.
33+
34+
Also, any files that start with `Person` (being the demonstration entity) should be removed (deleted) from their respective projects as they are encountered. This then represents the baseline to build up the solution from.
35+
36+
<br/>
37+
38+
## Next Step
39+
40+
Next, we can begin creating the [employee DB](./2-Employee-DB.md) and related database objects required for the sample.<br/>
41+
42+
<br/>
43+
44+
## Appendix
45+
46+
For more detail on the solution template see the following docs:
47+
* [Solution Template](../../../templates/Beef.Template.Solution/README.md)
48+
* [Getting started guide](../../../docs/Sample-SqlServer-EF-GettingStarted.md).

Diff for: samples/MyEf.Hr/docs/Service-Bus-Subscribe.md renamed to samples/MyEf.Hr/docs/10-Service-Bus-Subscribe.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Step 9 - Service Bus Subscribe
1+
# Step 10 - Service Bus Subscribe
22

33
At a high-level this represents the subscribing of events/messages from Azure Service Bus to meet the stated requirements of when an Employee is _terminated_ that the Employee's User Account will be automatically _deactivated_ within OKTA.
44

@@ -445,8 +445,12 @@ Now that all the moving parts have been developed and configured an end-to-end i
445445

446446
<br/>
447447

448-
## Conclusion
448+
## Verify
449449

450450
The new _Security_ domain that performs a [Service Bus Subscribe](./Service-Bus-Subscribe.md) of the _Termination_ related events and proxies [Okta]() (as our identity solution) automatically _Deactivating_ the Employee's account is complete.
451451

452+
<br/>
453+
454+
## Next Step
455+
452456
Next we will [wrap up](./../README.md#Conclusion) the sample - we are done!

Diff for: samples/MyEf.Hr/docs/Employee-DB.md renamed to samples/MyEf.Hr/docs/2-Employee-DB.md

+50-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# Step 1 - Employee DB
1+
# Step 2 - Employee DB
22

33
This will walk through the process of creating the required tables, and entity framework capabilities, etc. needed for the `Employee` within a Microsoft SQL Server database. All of this work will occur within the context of the `MyEf.Hr.Database` project.
44

55
The [`Beef.Database.SqlServer`](../../../tools/Beef.Database.SqlServer) and [`DbEx`](https://github.com/Avanade/dbex) provide the capabilities that will be leveraged. The underlying [documentation](https://github.com/Avanade/dbex#readme) describes these capabilities and the database approach in greater detail.
66

7-
_Note:_ Any time that command line execution is requested, this should be performed from the base `MyEf.Hr.Database` folder. To see all supported command line options execute `dotnet run -- --help`.
7+
<br/>
8+
9+
## Terminal
10+
11+
The database codegen and DbEx commands will run from a command-line interface. In preparation for the steps below, open a new terminal/command-prompt and navigate to the `MyEf.Hr.Database` base folder directory
12+
13+
_Note: To see all supported command line options execute `dotnet run -- --help`._
814

915
<br/>
1016

@@ -45,6 +51,7 @@ Create the `Hr` schema using the database tooling. The following command will cr
4551
dotnet run script schema Hr
4652
```
4753

54+
<br/>
4855

4956
## Create Employee table
5057

@@ -137,16 +144,19 @@ dotnet run script refdata Hr USState
137144

138145
Now that the Reference Data tables exist they will need to be populated. It is recommended that where possible that the Production environment values are specified (as these are intended to be deployed to all environments).
139146

140-
These values (database rows) are specified using YAML. For brevity in this document, copy the data for the above tables **only** (for now) from [`RefData.yaml`](../MyEf.Hr.Database/Data/RefData.yaml) replacing the contents of the prefilled `RefData.yaml` within the `My.Hr.Database/Data` folder. Finally, remove the `PerformanceOutcome` lines at the end of the file.
147+
These values (database rows) are specified using YAML. For brevity in this document we will grab the data we need from [`RefData.yaml`](../MyEf.Hr.Database/Data/RefData.yaml). Take the contents of this file, copy and replace the contents of the prefilled `RefData.yaml` within the `My.Hr.Database/Data` folder. Finally, remove the `PerformanceOutcome` lines at the end of the file (we are not creating or populating this table for now).
141148

142-
_Note:_ The format and hierarchy for the YAML, is: Schema, Table, Row. For reference data tables where only `Code: Text` is provided, this is treated as a special case shorthand to update those two columns accordingly (the other columns will be updated automatically). The `$` prefix for a table indicates a `merge` versus an `insert` (default).
149+
_Note: The format and hierarchy for the YAML, is: Schema, Table, Row. For reference data tables where only `Code: Text` is provided, this is treated as a special case shorthand to update those two columns accordingly (the other columns will be updated automatically). The `$` prefix for a table indicates a `merge` versus an `insert` (default)._
143150

144151
``` yaml
145152
Hr:
146153
- $Gender:
147154
- F: Female
148155
- M: Male
149156
- N: Not specified
157+
- $TerminationReason:
158+
- RE: Resigned
159+
...
150160
...
151161
```
152162

@@ -156,7 +166,7 @@ Hr:
156166

157167
To support the requirement to query the Reference Data values from the database we will use Entity Framework (EF) to simplify. The Reference Data table configuration will drive the EF .NET (C#) model code-generation via the `efModel: true` attribute.
158168

159-
Remove all existing configuration from `database.beef-5.yaml` and replace. Each table configuration is referencing the underlying table and schema, then requesting an EF model is created for all related columns found within the database. _Beef_ will query the database to infer the columns during code-generation to ensure it "understands" the latest configuration.
169+
Remove all existing configuration from `database.beef-5.yaml` and replace with the contents below. Each table configuration is referencing the underlying table and schema, then requesting an EF model is created for all related columns found within the database. _Beef_ will query the database to infer the columns during code-generation to ensure it "understands" the latest configuration.
160170

161171
``` yaml
162172
# Configuring the code-generation global settings
@@ -234,19 +244,46 @@ dotnet run codegen
234244
dotnet run database
235245
```
236246

237-
This should create migrations script files with names similar as follows (as well as a number of other SQL and .NET related artefacts).
247+
<br/>
248+
249+
## Verify
250+
251+
At this stage we now have a working database ready for the consuming API logic to be added. The required database tables exist, the Reference Data data has been loaded, the required stored procedures and user-defined type (UDT) for the Event outbox have been generated and added to the database. The .NET (C#) Entity Framework models have been generated and added to the `My.Hr.Business` project, including the requisite event outbox enqueue/dequeue capabilities.
252+
253+
To verify, confirm you have the below set of sql migration scripts:
238254

239255
```
240256
└── Migrations
241-
└── 20210430-170605-create-01-create-outbox-schema.sql
242-
└── 20210430-170605-create-01-create-outbox-eventoutbox-table.sql
243-
└── 20210430-170605-create-01-create-outbox-eventoutboxdata-table.sql
257+
└── <date>-<number>-create-hr-schema.sql
258+
└── <date>-<number>-create-hr-employee-table.sql
259+
└── <date>-<number>-create-hr-emergencycontact-table.sql
260+
└── <date>-<number>-create-hr-gender-refdata-table.sql
261+
└── <date>-<number>-create-hr-terminationreason-refdata-table.sql
262+
└── <date>-<number>-create-hr-relationshiptype-refdata-table.sql
263+
└── <date>-<number>-create-hr-usstate-refdata-table.sql
264+
└── <date>-<number>-01-create-outbox-schema.sql
265+
└── <date>-<number>-02-create-outbox-eventoutbox-table.sql
266+
└── <date>-<number>-03-create-outbox-eventoutboxdata-table.sql
244267
```
245268

246-
<br/>
269+
Confirm also, the following DB and tables have been created (utilizing a DB tool such as Azure Data Explorer or SSMS):
270+
```
271+
└── Local
272+
└── Databases
273+
└── MyEf.Hr
274+
└── Tables
275+
└── Hr.EmergencyContact
276+
└── Hr.Employee
277+
└── Hr.Gender
278+
└── Hr.RelationshipType
279+
└── Hr.TerminationReason
280+
└── Hr.USState
281+
└── Outbox.EventOutbox
282+
└── Outbox.EventOutboxData
283+
```
247284

248-
## Conclusion
285+
<br/>
249286

250-
At this stage we now have a working database ready for the consuming API logic to be added. The required database tables exist, the Reference Data data has been loaded, the required stored procedures and user-defined type (UDT) for the Event outbox have been generated and added to the database. The .NET (C#) Entity Framework models have been generated and added to the `My.Hr.Business` project, including the requisite event outbox enqueue/dequeue capabilities.
287+
## Next Step
251288

252-
Next we need to create the [employee API](./Employee-Api.md) endpoint to perform the desired CRUD operations.
289+
Next, we need to create the [employee API](./3-Employee-Api.md) endpoint to perform the desired CRUD operations.

0 commit comments

Comments
 (0)