BertoSoftware.DapperScaffolding
0.1.0-alpha3
dotnet tool install --global BertoSoftware.DapperScaffolding --version 0.1.0-alpha3
dotnet new tool-manifest
dotnet tool install --local BertoSoftware.DapperScaffolding --version 0.1.0-alpha3
#tool dotnet:?package=BertoSoftware.DapperScaffolding&version=0.1.0-alpha3&prerelease
nuke :add-package BertoSoftware.DapperScaffolding --version 0.1.0-alpha3

Dapper Scaffolding
Scaffold Dapper-friendly model classes from an existing database schema.
This CLI tool inspects the database schema using the DefaultConnection string in a target project's appsettings.json and generates simple POCO model files (VB.NET or C#) into a specified folder inside that project.

Features
- Generate one model file per table using provider-specific scaffolding.
- Console UI with progress and status messages.
- Output languages: VB.NET and C#.
- Supports SQL Server and MySQL providers (others declared in the CLI are not implemented).
Requirements
- .NET 10.0 SDK or later (use
dotnet --versionto check). - A target project containing
appsettings.jsonwith aDefaultConnectionconnection string.
Quick Start
- Install the package globally using the .NET CLI:
dotnet tool install -g BertoSoftware.DapperScaffolding
Run the scaffold command (example):
dapper-scaffolding scaffold --project YourProject.csproj --provider SqlServer --language CSharp --output Model --delete-folder true
Options summary:
--project(-prj): Path to the target project file (.csprojor.vbproj) or directory containing a project file. If a directory is provided, the tool will auto-detect the project file. (optional, defaults to current directory)--provider(-prov): Database provider. Supported:SqlServer,MySql. (defaults toSqlServer)--language(-lang): Output language. Values:VBNet,CSharp. (defaults toCSharp)--output(-out): Output folder relative to the project directory. (defaults toModel)--delete-folder(-del): When provided, the target output folder is deleted and recreated before generation. (optional, defaults tofalse)
Configuration
The tool reads the DefaultConnection string from the target project's appsettings.json. Example:
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=MyDb;User Id=sa;Password=YourPassword;"
}
}
If appsettings.json is missing or DefaultConnection is not present, the tool will exit with a clear error message.
Supported Providers
SqlServer(implemented)MySql(implemented)PostgreSql(declared, not implemented)Sqlite(declared, not implemented)Firebird(declared, not implemented)
Behavior & Output
- The tool connects to the database and enumerates tables (via INFORMATION_SCHEMA or provider-specific queries).
- For each table, it applies an embedded SQL template and writes a
.vbor.csfile named<TableName>.vb/<TableName>.csinto the chosen output folder inside the project directory. - After generation, include the generated folder in your project (e.g., add a
<Compile Include="Model\\**\\*.vb" />entry in a.vbproj). - The tool returns appropriate exit codes for scripting/CI integration:
0: Success1: appsettings.json not found2: DefaultConnection string not found3: Exception occurred4: Project file not found5: Invalid arguments6: Provider not implemented99: Unexpected error
Example project
See the example project configuration at DapperScaffoldingExample/appsettings.json.
Where to look in the source
- CLI and options: DapperScaffolding/Program.vb
- Providers implementation: DapperScaffolding/Providers
License & Links
- License: MIT
- Repository: https://github.com/berto82/DapperScaffolding
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 0.1.0-alpha3 | 123 | 2/10/2026 | |
| 0.1.0-alpha2 | 138 | 2/8/2026 |