Skip to content

Commit

Permalink
Finalizing CI and doco.
Browse files Browse the repository at this point in the history
  • Loading branch information
chullybun committed Mar 4, 2024
1 parent bc6a004 commit e277d74
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
working-directory: ./Foo.Ef.Bar
run: dotnet test

# Template - Sql Server with Entity Framework
# Template - Sql Server with Stored Procedures

- name: Template/SqlServer/Sp create
run: dotnet new beef --company Foo.Sp --appname Bar --datasource SqlServerProcs --output Foo.Sp.Bar
Expand Down Expand Up @@ -312,17 +312,21 @@ jobs:

# Template - Sql Server with Entity Framework and Azure Functions Service

- name: Template/SqlServer/SpWs create
run: dotnet new beef --company Foo.SpWs --appname Bar --datasource SqlServerProcs --output Foo.SpWs.Bar
- name: Template/SqlServer/EfWs create
run: dotnet new beef --company Foo.EfWs --appname Bar --datasource SqlServer --services AzFunction --output Foo.EfWs.Bar

- name: Template/SqlServer/SpWs database
working-directory: ./Foo.SpWs.Bar/Foo.SpWs.Bar.Database
- name: Template/SqlServer/EfWs database
working-directory: ./Foo.EfWs.Bar/Foo.EfWs.Bar.Database
run: dotnet run dropandall --connection-varname Bar_ConnectionStrings__Database --accept-prompts

- name: Template/SqlServer/SpWs code-gen
working-directory: ./Foo.SpWs.Bar/Foo.SpWs.Bar.CodeGen
- name: Template/SqlServer/EfWs code-gen
working-directory: ./Foo.EfWs.Bar/Foo.EfWs.Bar.CodeGen
run: dotnet run all

- name: Template/SqlServer/SpWs test
working-directory: ./Foo.SpWs.Bar
- name: Template/SqlServer/EfWs test
working-directory: ./Foo.EfWs.Bar/Foo.EfWs.Bar.Test
run: dotnet test

- name: Template/SqlServer/EfWs services test
working-directory: ./Foo.EfWs.Bar/Foo.EfWs.Bar.Services.Test
run: dotnet test
27 changes: 26 additions & 1 deletion docs/Sample-SqlServer-EF-GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,29 @@ Open the solution within Visual Studio:
```
cd ..
Foo.Bar.sln
```
```

<br/>

## Subscribing Services

Within a microservices context, where event-based message streaming is used, the templated code from above instantiates the foundation. To further implement this pattern then a domain will likely also need to subscribe to events. An additional `dotnet new beef ... --services AzFunction` switch will also create the required Azure Function _Services_ project and related configuration; including an example unit test. The template will also further implement with an expectation that the event-based messaging infrastructure is Azure Service Bus.

```
dotnet new beef --company Foo --appname Bar --datasource SqlServer --services AzFunction
```

The solution should now have been created; and the file system should look like the following:

```
└── Foo.Bar
└── Foo.Bar.Api # API end-point and operations
└── Foo.Bar.Business # Core business logic components
└── Foo.Bar.CodeGen # Entity and Reference Data code generation console
└── Foo.Bar.Database # Database setup and configuration
└── Foo.Bar.Common # Common / shared components
└── Foo.Bar.Test # Unit and intra-integration tests for Business and Api
└── Foo.Bar.Services # Azure Function Services **NEW**
└── Foo.Bar.Services.Test # Unit and intra-integration tests for Services **NEW**
└── Foo.Bar.sln # Solution file that references all above projects
```
4 changes: 2 additions & 2 deletions samples/Demo/Beef.Demo.Business/Data/PersonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ private async Task<PersonDetail> GetDetailOnImplementationAsync(Guid id)
{
PersonDetail? pd = null;

System.Diagnostics.Debug.WriteLine($"One, Thread: {System.Threading.Thread.CurrentThread.ManagedThreadId }");
System.Diagnostics.Debug.WriteLine($"One, Thread: {Environment.CurrentManagedThreadId}");
await GetAsync(id);

System.Diagnostics.Debug.WriteLine($"Two, Thread: {System.Threading.Thread.CurrentThread.ManagedThreadId }");
System.Diagnostics.Debug.WriteLine($"Two, Thread: {Environment.CurrentManagedThreadId}");
await _db.StoredProcedure("[Demo].[spPersonGetDetail]")
.Param("PersonId", id)
.SelectMultiSetAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ partial void PersonDataCtor()
#if (implement_database)
private void GetByArgsOnQuery(DatabaseParameterCollection p, PersonArgs? args)
{
p.ParamWithWildcard(args?.FirstName, DbMapper.Default[nameof(Person.FirstName)])
.ParamWithWildcard(args?.LastName, DbMapper.Default[nameof(Person.LastName)])
p.ParamWithWildcard(args?.FirstName, "FirstName")
.ParamWithWildcard(args?.LastName, "LastName")
.TableValuedParamWith(args?.Genders, "GenderCodes", () => _db.CreateTableValuedParameter(args!.Genders!.ToCodeList()));
}
#endif
Expand Down

0 comments on commit e277d74

Please sign in to comment.