Install
dotnet add package EzDbSchema.Cli --version 9.0.2
No framework information available.
README
EzDbSchema CLI Tool
A command-line interface for EzDbSchema that allows you to analyze database schemas, generate code, and export schema documentation.
Installation
Using .NET Tool
dotnet tool install --global EzDbSchema.Cli
Building from Source
git clone https://github.com/rvegajr/ez-db-schema-core.git
cd ez-db-schema-core/Src/EzDbSchema.Cli
dotnet build
dotnet pack
Usage
Basic Commands
- Analyze Database Schema
ezdb analyze --connection "Server=myserver;Database=mydb;User Id=sa;Password=****;TrustServerCertificate=True"
- Generate Code
ezdb generate --connection "..." --language csharp --output ./output
- Export Schema Documentation
ezdb export --connection "..." --format markdown --output schema.md
Command Options
Analyze Command
ezdb analyze [options]
Options:
--connection, -c: Connection string (required)--output, -o: Output file path for schema JSON--schema, -s: Database schema name (default: dbo)--verbose, -v: Enable verbose output
Generate Command
ezdb generate [options]
Options:
--connection, -c: Connection string (required)--language, -l: Target language (csharp, typescript, python, go, java)--output, -o: Output directory (required)--template, -t: Template directory--namespace, -n: Root namespace--orm: ORM framework (ef, typeorm, sqlalchemy)--include-views: Include database views--generate-tests: Generate unit tests
Export Command
ezdb export [options]
Options:
--connection, -c: Connection string (required)--format, -f: Output format (json, markdown, html)--output, -o: Output file path--include-relationships: Include relationship diagrams--include-constraints: Include constraint details
Examples
- Generate C# Entity Framework Models
ezdb generate \
--connection "Server=localhost;Database=northwind;Trusted_Connection=True;" \
--language csharp \
--orm ef \
--output ./Models \
--namespace MyApp.Domain \
--include-views
- Generate TypeScript Models with TypeORM
ezdb generate \
--connection "..." \
--language typescript \
--orm typeorm \
--output ./src/models
- Export Markdown Documentation
ezdb export \
--connection "..." \
--format markdown \
--output docs/schema.md \
--include-relationships \
--include-constraints
- Analyze and Save Schema
ezdb analyze \
--connection "..." \
--output schema.json \
--schema dbo \
--verbose
Configuration File
You can create an ezdb.json configuration file to store common settings:
{
"connectionStrings": {
"dev": "Server=dev-db;Database=myapp;...",
"prod": "Server=prod-db;Database=myapp;..."
},
"defaultLanguage": "csharp",
"defaultOrm": "ef",
"templates": {
"path": "./templates",
"customMappings": {
"datetime": "DateTimeOffset",
"varchar": "string"
}
},
"output": {
"path": "./generated",
"cleanDirectory": true
}
}
Then use it with:
ezdb generate --config ezdb.json --connection-name dev
Templates
EzDbSchema CLI supports custom templates using Handlebars syntax. Create a template directory with:
templates/
βββ entity/
β βββ class.hbs
β βββ interface.hbs
β βββ dto.hbs
βββ dbcontext/
β βββ context.hbs
βββ helpers/
βββ types.hbs
Use custom templates with:
ezdb generate --template ./templates
Environment Variables
EZDB_CONNECTION_STRING: Default connection stringEZDB_OUTPUT_PATH: Default output pathEZDB_TEMPLATE_PATH: Default template pathEZDB_CONFIG_FILE: Default config file path
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changes from Previous Version
No structural changes between v9.0.1 and v9.0.2.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.