EfBootstrap 1.1.1

dotnet tool install --global EfBootstrap --version 1.1.1
                    
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 EfBootstrap --version 1.1.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=EfBootstrap&version=1.1.1
                    
nuke :add-package EfBootstrap --version 1.1.1
                    

๐Ÿš€ EF Core Project Bootstrapper (EfBootstrap)

A .NET Global CLI Tool to bootstrap production-ready backend projects using Entity Framework Core.

NuGet Version License: MIT


๐Ÿ“ฆ Installation

# Install globally
dotnet tool install -g EfBootstrap

# Update to latest version
dotnet tool update -g EfBootstrap

# Uninstall
dotnet tool uninstall -g EfBootstrap

๐ŸŽฏ Commands

efbootstrap init

Initialize a new EF Core project with folder structure, packages, and database scaffolding.

efbootstrap init [options]
Options
Option Alias Description Default
--path -p Path to the project directory Current directory
--connection-string -c Database connection string for scaffolding (interactive prompt)
--localhost -l Use localhost database true
--repositories -r Create Repositories folder false
--skip-scaffold -s Skip database scaffolding false
--non-interactive -n Run in non-interactive mode (for CI/CD) false
Examples
# Interactive mode (recommended for first-time setup)
efbootstrap init

# Initialize with LocalDB connection string
efbootstrap init -c "Server=(localdb)\MSSQLLocalDB;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True;"

# Initialize with repositories folder
efbootstrap init -r

# Skip scaffolding (just create folders and install packages)
efbootstrap init -s

# Non-interactive mode for CI/CD
efbootstrap init -n -c "Server=(localdb)\MSSQLLocalDB;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True;"

# Specify a different project path
efbootstrap init -p "C:\Projects\MyNewProject"

efbootstrap scaffold

Scaffold database entities and DbContext. Use this to retry scaffolding after a failure or run scaffolding separately.

efbootstrap scaffold [options]
Options
Option Alias Description Default
--path -p Path to the project directory Current directory
--connection-string -c Database connection string (interactive prompt)
--non-interactive -n Run in non-interactive mode false
Examples
# Interactive mode with detailed connection string guidance
efbootstrap scaffold

# Scaffold with specific connection string
efbootstrap scaffold -c "Server=(localdb)\MSSQLLocalDB;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True;"

# Scaffold for a different project path
efbootstrap scaffold -p "C:\Projects\MyProject" -c "Server=localhost;Database=MyDb;Trusted_Connection=True;"

# Non-interactive mode
efbootstrap scaffold -n -c "Server=(localdb)\MSSQLLocalDB;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True;"

๐Ÿ“‹ Connection String Examples

Server=(localdb)\MSSQLLocalDB;Database=YourDatabaseName;Trusted_Connection=True;TrustServerCertificate=True;

Prerequisites:

  • SQL Server LocalDB installed (comes with Visual Studio)
  • Database must exist before scaffolding

Useful Commands:

# Check if LocalDB is running
sqllocaldb info MSSQLLocalDB

# Start LocalDB
sqllocaldb start MSSQLLocalDB

# Create a new database
sqlcmd -S (localdb)\MSSQLLocalDB -Q "CREATE DATABASE YourDatabaseName"

# List existing databases
sqlcmd -S (localdb)\MSSQLLocalDB -Q "SELECT name FROM sys.databases"

SQL Server (localhost)

Server=localhost;Database=YourDb;Trusted_Connection=True;TrustServerCertificate=True;

For SQL Server Express:

Server=localhost\SQLEXPRESS;Database=YourDb;Trusted_Connection=True;TrustServerCertificate=True;

Remote SQL Server / Azure SQL

Server=yourserver.database.windows.net;Database=YourDb;User Id=username;Password=yourpassword;TrustServerCertificate=True;

๐Ÿ— Generated Project Structure

YourProject/
โ”œโ”€โ”€ Controllers/
โ”œโ”€โ”€ Models/          โ† Entity classes generated here
โ”œโ”€โ”€ DTOs/
โ”œโ”€โ”€ Data/
โ”‚   โ””โ”€โ”€ AppDbContext.cs
โ”œโ”€โ”€ Services/
โ””โ”€โ”€ Repositories/    โ† Optional (use -r flag)

โš™๏ธ What the Tool Does

1๏ธโƒฃ Creates Folder Structure

Automatically creates standard backend folders:

  • Controllers - API controllers
  • Models - Entity classes (EF Core models)
  • DTOs - Data Transfer Objects
  • Data - DbContext and database configuration
  • Services - Business logic services
  • Repositories - Repository pattern classes (optional)

2๏ธโƒฃ Installs EF Core Packages

Installs required NuGet packages:

  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Tools

3๏ธโƒฃ Scaffolds Database

Runs EF Core scaffolding to generate:

  • Entity model classes from database tables
  • AppDbContext class with DbSet properties

Equivalent to running:

dotnet ef dbcontext scaffold "ConnectionString" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models --context-dir Data --context AppDbContext --force

๐Ÿ”ง Troubleshooting

Scaffolding Failed

Common causes:

  1. SQL Server not running

    # For LocalDB
    sqllocaldb start MSSQLLocalDB
    
    # For SQL Server, check Windows Services
    
  2. Database doesn't exist

    sqlcmd -S (localdb)\MSSQLLocalDB -Q "CREATE DATABASE YourDatabaseName"
    
  3. Wrong server name

    • LocalDB: (localdb)\MSSQLLocalDB
    • SQL Express: localhost\SQLEXPRESS or .\SQLEXPRESS
    • Default instance: localhost or .
  4. TCP/IP disabled

    • Open SQL Server Configuration Manager
    • Enable TCP/IP under SQL Server Network Configuration
  5. Firewall blocking connection

    • Allow SQL Server through Windows Firewall

Retry Scaffolding

If scaffolding fails during init, you can retry using:

efbootstrap scaffold

๐Ÿ”Œ Supported Platforms

Component Support
.NET 6.0, 7.0, 8.0, 9.0, 10.0+
EF Core Any compatible version
OS Windows / macOS / Linux
Database SQL Server, LocalDB

๐Ÿ›ฃ Roadmap

โœ… Phase 1 (Current - v1.1.0)

  • SQL Server & LocalDB support
  • Folder scaffolding
  • EF Core package installation
  • DbContext generation
  • Separate scaffold command for retry
  • Detailed connection string guidance

๐Ÿ”œ Phase 2

  • MySQL & PostgreSQL support
  • Additional database providers

๐Ÿ“‹ Phase 3

  • Custom project templates
  • Clean Architecture presets
  • Optional Unit of Work pattern

๐Ÿ“– Quick Start

# 1. Install the tool
dotnet tool install -g EfBootstrap

# 2. Navigate to your project
cd YourProject

# 3. Run initialization
efbootstrap init

# 4. Follow the interactive prompts
#    - Select database type (LocalDB/SQL Server/Remote)
#    - Enter connection string
#    - Choose whether to create Repositories folder

# 5. Done! Your project is ready with:
#    - Folder structure
#    - EF Core packages
#    - Generated entity models and DbContext

๐Ÿงช CI/CD Usage

For automated pipelines, use non-interactive mode:

efbootstrap init -n -c "Server=(localdb)\MSSQLLocalDB;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True;" -r

๐Ÿ“ License

MIT License - Copyright ยฉ 2025 Shalin Shah, SSB DIGITAL


๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“ฌ Support

For issues and feature requests, please use the GitHub Issues page.

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
1.1.1 100 1/6/2026
1.0.0 91 1/6/2026