BertoSoftware.DapperScaffolding 0.1.0-alpha3

This is a prerelease version of BertoSoftware.DapperScaffolding.
dotnet tool install --global BertoSoftware.DapperScaffolding --version 0.1.0-alpha3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local BertoSoftware.DapperScaffolding --version 0.1.0-alpha3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=BertoSoftware.DapperScaffolding&version=0.1.0-alpha3&prerelease
                    
nuke :add-package BertoSoftware.DapperScaffolding --version 0.1.0-alpha3
                    

Banner

GitHub License NuGet Version NuGet Downloads GitHub Release Date GitHub last commit (branch)

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.

Video Demo

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 --version to check).
  • A target project containing appsettings.json with a DefaultConnection connection 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 (.csproj or .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 to SqlServer)
  • --language (-lang): Output language. Values: VBNet, CSharp. (defaults to CSharp)
  • --output (-out): Output folder relative to the project directory. (defaults to Model)
  • --delete-folder (-del): When provided, the target output folder is deleted and recreated before generation. (optional, defaults to false)

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 .vb or .cs file named <TableName>.vb/<TableName>.cs into 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: Success
    • 1: appsettings.json not found
    • 2: DefaultConnection string not found
    • 3: Exception occurred
    • 4: Project file not found
    • 5: Invalid arguments
    • 6: Provider not implemented
    • 99: Unexpected error

Example project

See the example project configuration at DapperScaffoldingExample/appsettings.json.

Where to look in the source

License & Links

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 0.1.0-alpha2 is deprecated because it is no longer maintained.