You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Sample-EntityFramework-GettingStarted.md
+4-3
Original file line number
Diff line number
Diff line change
@@ -19,10 +19,12 @@ It is recommended that the following is installed to simplify the opening of a c
19
19
20
20
The [`Beef.Template.Solution`](../templates/Beef.Template.Solution/README.md) needs to be installed so that it can be used to easily create the required [solution structure](./Solution-Structure.md).
21
21
22
-
Install (or update) the latest template from the public [NuGet](https://www.nuget.org/packages/Beef.Template.Solution/) repository using the `dotnet new -i` command as follows:
22
+
Install (or update) the latest template from the public [NuGet](https://www.nuget.org/packages/Beef.Template.Solution/) repository using the [`dotnet new -i`](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-new-install) command as follows (or alternatively specify the required version):
23
23
24
24
```
25
25
dotnet new -i beef.template.solution --nuget-source https://api.nuget.org/v3/index.json
26
+
27
+
dotnet new -i beef.template.solution::5.1.preview1 --nuget-source https://api.nuget.org/v3/index.json
26
28
```
27
29
28
30
<br/>
@@ -83,10 +85,9 @@ Generate the configured tables and C# models:
83
85
```
84
86
cd Foo.Bar.Database
85
87
dotnet run all
86
-
dotnet run codegen --script DatabaseEventOutbox.xml
87
88
```
88
89
89
-
This will build and run the `Foo.Bar.Database` console; the outcome of the code generation and database setup/configuration will be logged to the console showing what was added or updated. The final command will create the required migration scripts for the event outbox functionality.
90
+
This will build and run the `Foo.Bar.Database` console; the outcome of the code generation and database setup/configuration will be logged to the console showing what was added or updated.
Copy file name to clipboardExpand all lines: samples/Demo/Beef.Demo.Database/Schema/Outbox/Types/User-Defined Table Types/Generated/udtEventOutboxList.sql
+1
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ CREATE TYPE [Outbox].[udtEventOutboxList] AS TABLE (
Copy file name to clipboardExpand all lines: samples/My.Hr/README.md
+13-1
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,16 @@ This sample will walkthrough an approach of adding the capabilities in a series
8
8
9
9
</br>
10
10
11
+
## Beef primer
12
+
13
+
_Beef_ is obstensibly the code-generation engine that ultimately takes dependencies on the following capabilities to enable the end-to-functionality and testing thereof:
14
+
-[CoreEx](https://github.com/Avanade/CoreEx) - provides the core runtime capabilties (extends .NET core);
-[OnRamp](https://github.com/Avanade/OnRamp) - provides the underlying code-generation engine functionality; and,
17
+
-[UnitTestEx](https://github.com/Avanade/UnitTestEx) - provides extended unit and intra-domain integration testing.
18
+
19
+
</br>
20
+
11
21
## Scope
12
22
13
23
Within the sample there will two primary entities exposed:
@@ -102,4 +112,6 @@ The basis of the functional capabilities have been created for our fictitious so
102
112
103
113
The developer should have witnessed that reasonably complicated logic can be built using this _config_ to _code-gen_ to _custom_ approach. Where the _custom_ effort is for the most part focused on the key business value delivery; not the related boilerplate. Plus, with the testing framework, how complex end-to-end intra-domain integration tests can be created to appropriately validate the underlying logic - which can easily be integrated into the developer build-test-release lifecycle.
104
114
105
-
It is acknowledged that there is a learning curve required for using _Beef_; and in time greater acceleration will be achieved as experience is gained. Please review the extended documentation and provide feedback, questions, defects, etc. via a [issue](https://github.com/Avanade/Beef/issues). Thanks and enjoy :-)
115
+
It is acknowledged that there is a learning curve required for using _Beef_; and in time greater acceleration will be achieved as experience is gained. Please review the extended documentation and provide feedback, questions, defects, etc. via an [issue](https://github.com/Avanade/Beef/issues).
Copy file name to clipboardExpand all lines: samples/My.Hr/docs/Employee-DB.md
+18-12
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,23 @@
2
2
3
3
This will walk through the process of creating the required tables, and stored procedures, etc. needed for the `Employee` within a Microsoft SQL Server database. All of this work will occur within the context of the `My.Hr.Database` project.
4
4
5
-
The [`Beef.Database.Core`](../../../tools/Beef.Database.Core/README.md) provides the capabilities that will be leveraged. The underlying documentation describes these capabuilities and the database approach in greater detail.
5
+
The [`Beef.Database.Core`](../../../tools/Beef.Database.Core/README.md) provides the capabilities that will be leveraged. The underlying documentation describes these capabilities and the database approach in greater detail.
6
6
7
7
_Note:_ Any time that command line execution is requested, this should be performed from the base `My.Hr.Database` folder.
8
8
9
9
<br/>
10
10
11
11
## Entity relationship diagram
12
12
13
-
The following provides a visual (ERD) for the database tables that will be created. A relationship label of _refers_ indicates a reference data relationship. The _(via JSON)_ implies that the relating table references invisibly to the database via a JSON data column.
13
+
The following provides a visual (ERD) for the database tables that will be created. A relationship label of _refers_ indicates a reference data relationship. The _(via JSON)_ implies that the relating entity references via a JSON data column (_not_ a referenced database table).
14
14
15
15
```mermaid
16
16
erDiagram
17
17
Employee ||--o{ EmergencyContact : has
18
18
Employee }|..|{ Gender : refers
19
19
Employee }|..|{ TerminationReason : refers
20
-
Employee }|..|{ USState : "refers (via JSON)"
20
+
Employee }|..|{ USState : refers
21
+
Employee ||--o{ Address : has (via JSON)
21
22
EmergencyContact }|..|{ RelationshipType : refers
22
23
```
23
24
@@ -136,7 +137,7 @@ dotnet run script refdata Hr USState
136
137
137
138
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).
138
139
139
-
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`](../My.Hr.Database/Data/RefData.yaml) replacing the contents of the prefilled `RefData.yaml` within the `My.Hr.Database/Data` folder.
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`](../My.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.
140
141
141
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).
142
143
@@ -160,12 +161,8 @@ Remove all existing configuration from `database.beef.yaml` and replace. Each ta
160
161
```yaml
161
162
# Configuring the code-generation global settings
162
163
# - Schema defines the default for al tables unless explicitly defined.
163
-
# - EventOutbox indicates whether events will publish using the outbox pattern and therefore the event outbox artefacts are required.
164
-
# - EntityScope of Autonomous will generate both business and common entities to allow each to be used autonomously; versus using shared common.
165
164
#
166
165
schema: Hr
167
-
eventOutbox: true
168
-
entityScope: Autonomous
169
166
tables:
170
167
# Reference data tables/models.
171
168
- { name: Gender, efModel: true }
@@ -278,18 +275,27 @@ Where tables need indexes and other constraints added these would be created usi
278
275
279
276
## Event outbox
280
277
281
-
To support the [transactional outbox pattern](https://microservices.io/patterns/data/transactional-outbox.html) there is the need to have the backing event queue tables. The migration scripts to create these can be code generated using the following.
278
+
To support the [transactional outbox pattern](https://microservices.io/patterns/data/transactional-outbox.html) there is the need to have backing event queue tables. The migration scripts to create these can be code generated by adding the following to the top of the `database.beef-5.yaml` file directly under the `schema: hr` line.
279
+
280
+
``` yaml
281
+
outbox: true
282
+
outboxSchemaCreate: true
283
+
```
284
+
285
+
Execute the code-generation again using `codegen` option to generate the newly configured migration scripts. Once generated the database can be updated to use by using the `database` option. Run both of the following commands.
282
286
283
287
```
284
-
dotnet run codegen --script DatabaseEventOutbox
288
+
dotnet run codegen
289
+
dotnet run database
285
290
```
286
291
287
292
This should create two migrations script files with names similar as follows.
0 commit comments