Data Source
Data source recipe includes enough layers and feature implementations for a
backend application that is expected to provide data from configured data source
using report queries in .sql files.
To create an application from this recipe, use DataSource() extension of
Bake class directly in Program.cs.
Bake.New
.DataSource(
business: c => c.DomainAssemblies([...])
)
.Run();
Layers
| Name | Run | Test |
|---|---|---|
| Buildtime | ✅ | ✅ |
| Data Access | ✅ | ✅ |
| Domain | ✅ | ✅ |
| HTTP Server | ✅ | ⛔ |
| Rest API | ✅ | ⛔ |
| Runtime | ✅ | ✅ |
| Testing | ⛔ | ✅ |
Features
| Name | Run | Test |
|---|---|---|
| Binding(s) | ✅ | ✅ |
| Rest | ||
| Business | ✅ (No Default) | ✅ |
| Caching(s) | ✅ | ✅ |
| In-Memory | ||
| Scoped Memory | ||
| Coding Style(s) | ✅ | ✅ |
| Add/Remove Child | ||
| Command Pattern | ||
| Id | ||
| Initializable | ||
| Label | ||
| Locatable | ||
| Namespace as Route | ||
| Query | ||
| Records are DTOs | ||
| Remaining Services are Singleton | ||
| Rich Transient | ||
| Scoped by Suffix | ||
| Use Built-in Types | ||
| Use Nullable Types | ||
| Value Type | ||
| Core | ✅ Dotnet | ✅ Mock |
| Database | ✅ Sqlite | ✅ In Memory |
| Exception Handling | ✅ Problem Details | ✅ |
| Greeting | ✅ Swagger | ⛔ |
| Lifetime(s) | ✅ | ✅ |
| Singleton | ||
| Scoped | ||
| Transient | ||
| Localization | ✅ .NET | ✅ |
| Logging | ✅ Request | ⛔ |
| Mocking Overrider | ⛔ | ✅ First Interface |
| Rate Limiter | ✅ Concurrency | ⛔ |
| Reporting | ✅ NativeSql | ✅ Mock |
When Test column have ✅ without a note, this means it inherits whatever Run column denotes.
Phase Execution Order
flowchart LR;
subgraph Generate
AD(AddDomainTypes)
BD(BuildDomainModel)
G(Generate)
C(Compile)
AD -->|IDomainTypeCollection| BD
BD -->|DomainModel| G
G -->|IGeneratedAssemblyCollection<br/>IGeneratedFileCollection| C
end
subgraph Start
CB(CreateBuilder)
BC(BuildConfiguration)
AS(AddServices)
B(Build)
PB(PostBuild)
R(Run)
CB -->|ConfigurationManager<br/>WebApplicationBuilder| BC
BC -->|GeneratedContext| AS
AS -->|IServiceCollection| B
B -->|IServiceProvider<br/>WebApplication|PB
PB --> R
end
Generate --> Start
Convention Order Matrix
flowchart LR
BIA(Infra)
BDA(Defaults)
BOA(Override)
BIC(Infra)
BDC(Defaults)
BOC(Override)
subgraph Business
direction LR
subgraph BA[Add]
direction TD
BIA --> BDA --> BOA
end
subgraph BC[Configure]
direction TD
BIC --> BDC --> BOC
end
end
BA --> BC