SuperPowerTool.Cli
1.0.0
dotnet add package SuperPowerTool.Cli --version 1.0.0
NuGet\Install-Package SuperPowerTool.Cli -Version 1.0.0
<PackageReference Include="SuperPowerTool.Cli" Version="1.0.0" />
<PackageVersion Include="SuperPowerTool.Cli" Version="1.0.0" />
<PackageReference Include="SuperPowerTool.Cli" />
paket add SuperPowerTool.Cli --version 1.0.0
#r "nuget: SuperPowerTool.Cli, 1.0.0"
#:package SuperPowerTool.Cli@1.0.0
#addin nuget:?package=SuperPowerTool.Cli&version=1.0.0
#tool nuget:?package=SuperPowerTool.Cli&version=1.0.0
PowerSuperTool CLI
Professional .NET code generator - Command Line Interface
📋 Overview
PowerSuperTool CLI is a command-line tool for generating professional C# code from JSON entity configurations or directly from your SQL Server database.
Features:
- Generate 8 file types from a single entity definition
- Import database tables as entity configurations
- Validate configurations before generation
- Full type mapping (30+ SQL Server types)
- Audit column detection and filtering
- Professional Handlebars templates
🚀 Quick Start
Build
dotnet build
Run
# Show help
dotnet run -- --help
# Generate code
dotnet run -- generate --config entity.json --output ../../src/MyApp
# Import from database
dotnet run -- database import --connection "Server=localhost;Database=MyDB;..." --table Customers --namespace MyApp.Customers
📚 Commands
generate - Generate C# Code
Generate C# files from entity configuration JSON.
Usage:
dotnet run -- generate \
--config customer.json \
--output ../../src/MyApp
Options:
--config(required) - Path to entity configuration JSON file--output(required) - Output directory for generated files
Output:
Generated files:
✓ Customer.cs (Entity)
✓ CustomerAppService.cs (Service)
✓ CustomerDto.cs (Data Transfer Object)
✓ CreateUpdateCustomerDto.cs (DTO for create/update)
✓ CustomerListDto.cs (DTO for list view)
✓ ICustomerRepository.cs + CustomerRepository.cs (Repository)
✓ CustomerPermissions.cs (Authorization)
✓ [timestamp]_CreateCustomer.cs (EF Core Migration)
validate - Validate Configuration
Validate entity configuration before generation.
Usage:
dotnet run -- validate --config customer.json
Options:
--config(required) - Path to configuration file
Output:
✓ Configuration is valid
Validation results:
- Entity name: Customer (PascalCase ✓)
- Namespace: MyApp.Customers (valid ✓)
- Properties: 5 (minimum 1 ✓)
- No duplicate properties ✓
database - Database Operations
Import database tables and manage connections.
database test-connection
Test SQL Server connectivity.
Usage:
dotnet run -- database test-connection \
--connection "Server=localhost;Database=MyDB;Integrated Security=true;"
Output:
✓ Connection successful
✓ Can access INFORMATION_SCHEMA
✓ Ready to import tables
database get-tables
List all tables in database.
Usage:
dotnet run -- database get-tables \
--connection "Server=localhost;Database=MyDB;Integrated Security=true;"
Output:
Available tables in MyDB:
- Customers
- Orders
- Products
- Categories
(4 tables found)
database get-schema
Get detailed table structure.
Usage:
dotnet run -- database get-schema \
--connection "Server=localhost;Database=MyDB;Integrated Security=true;" \
--table Customers
Output:
Table: Customers
Columns:
- Id (uniqueidentifier, NOT NULL, PRIMARY KEY)
- Email (nvarchar(255), NOT NULL)
- FirstName (nvarchar(100), NOT NULL)
- LastName (nvarchar(100), NULL)
- IsActive (bit, NOT NULL)
database import
Import table as entity configuration JSON.
Usage:
dotnet run -- database import \
--connection "Server=localhost;Database=MyDB;Integrated Security=true;" \
--table Customers \
--namespace MyApp.Customers \
--output Customer.json
Output:
✓ Imported table: Customers
✓ Entity name: Customer
✓ Properties: 4 (Id skipped as primary key)
✓ Generated: Customer.json
Configuration created:
{
"EntityName": "Customer",
"EntityNamePlural": "Customers",
"Namespace": "MyApp.Customers",
"TableName": "Customers",
"Properties": [...]
}
📝 Entity Configuration Format
Minimal Example
{
"EntityName": "Product",
"EntityNamePlural": "Products",
"Namespace": "MyApp.Products",
"Properties": [
{"Name": "Name", "Type": "string", "IsRequired": true},
{"Name": "Price", "Type": "decimal", "IsRequired": true}
]
}
Complete Example
{
"EntityName": "Customer",
"EntityNamePlural": "Customers",
"Namespace": "MyApp.Customers",
"TableName": "Customers",
"BaseClass": "FullAuditedEntity",
"PrimaryKeyType": "Guid",
"CreateUserInterface": true,
"CreatePermission": true,
"Properties": [
{
"Name": "Email",
"Type": "string",
"IsRequired": true,
"MaxLength": 255,
"IsSearchable": true,
"ShowInList": true,
"ShowInForm": true
},
{
"Name": "FirstName",
"Type": "string",
"IsRequired": true,
"MaxLength": 100
},
{
"Name": "IsActive",
"Type": "bool",
"IsRequired": true
}
]
}
🔧 Configuration Options
Entity Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| EntityName | string | ✓ | - | PascalCase entity name (singular) |
| EntityNamePlural | string | ✓ | - | Plural form of entity name |
| Namespace | string | ✓ | - | C# namespace |
| TableName | string | ✗ | EntityName | Database table name |
| BaseClass | string | ✗ | FullAuditedEntity | Base class (Entity, CreationAuditedEntity, AuditedEntity, FullAuditedEntity) |
| PrimaryKeyType | string | ✗ | Guid | Key type (Guid, int, long, string) |
| CreateUserInterface | bool | ✗ | false | Generate UI files |
| CreatePermission | bool | ✗ | true | Generate permission constants |
Property Options
| Property | Type | Default | Description |
|---|---|---|---|
| Name | string | - | PascalCase property name |
| Type | string | - | C# type (string, int, decimal, DateTime, bool, Guid, etc.) |
| IsRequired | bool | false | Validation: [Required] attribute |
| MaxLength | int? | null | String max length |
| IsSearchable | bool | false | Include in search filters |
| ShowInList | bool | false | Display in list views |
| ShowInForm | bool | false | Display in forms |
🗄️ Supported Data Types
SQL Server → C#
Numeric:
int→intbigint→longsmallint→shorttinyint→bytedecimal→decimalmoney→decimalfloat→doublereal→float
String:
varchar,nvarchar,char,nchar→stringtext,ntext→string
Date/Time:
datetime,datetime2→DateTimedate→DateTime(date only)time→TimeSpan(time only)datetimeoffset→DateTimeOffset(with timezone)
Boolean:
bit→bool
Binary & IDs:
uniqueidentifier→Guidbinary,varbinary,image→byte[]
🎯 Common Workflows
1. Generate from Database Table
# Step 1: List tables
dotnet run -- database get-tables \
--connection "Server=.\SQLEXPRESS;Database=Northwind;Integrated Security=true;"
# Step 2: Import specific table
dotnet run -- database import \
--connection "Server=.\SQLEXPRESS;Database=Northwind;Integrated Security=true;" \
--table Products \
--namespace MyApp.Products \
--output Product.json
# Step 3: Review and customize Product.json if needed
# Step 4: Generate code
dotnet run -- generate --config Product.json --output ../../src/MyApp
2. Generate from Manual Configuration
# Create customer.json manually or with Web UI
# Validate configuration
dotnet run -- validate --config customer.json
# Generate code
dotnet run -- generate --config customer.json --output ../../src/MyApp
3. Batch Import Multiple Tables
# Script to import all tables
for table in Customers Orders Products Categories
do
dotnet run -- database import \
--connection "Server=localhost;Database=Northwind;..." \
--table $table \
--namespace MyApp \
--output $table.json
done
# Generate all at once
for file in *.json
do
dotnet run -- generate --config $file --output ../../src/MyApp
done
🔐 Connection String Security
Never commit connection strings! Use environment variables:
Windows:
set CONNECTION_STRING=Server=localhost;Database=MyDB;...
dotnet run -- database import --connection "%CONNECTION_STRING%" --table Customers ...
Linux/Mac:
export CONNECTION_STRING="Server=localhost;Database=MyDB;..."
dotnet run -- database import --connection "$CONNECTION_STRING" --table Customers ...
🐛 Troubleshooting
"Entity name is required"
- Check EntityName field in configuration JSON
- Ensure it's not empty and follows PascalCase
"Connection failed"
- Verify SQL Server is running
- Check connection string syntax
- Verify credentials and database exists
- Test with:
dotnet run -- database test-connection --connection "..."
"Table not found"
- Use
database get-tablesto list available tables - Check spelling and case sensitivity
- Verify database name in connection string
"At least one property is required"
- Add properties array to configuration
- Database import should auto-generate properties
📖 Examples
See examples/ directory for complete configuration examples:
Customer.json- Simple entity with common propertiesOrder.json- Entity with dates and decimalsProduct.json- Entity with all data types
🔗 Related
- Web UI - Browser-based configuration
- User Guide - Complete documentation
- API Reference - REST API endpoints
- Database Support - Type mappings
📞 Support
- GitHub Issues: Report a bug
- Documentation: See
../../docs/directory
PowerSuperTool CLI v1.0.0
Generate professional .NET code in seconds! 🚀
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Handlebars.Net (>= 2.1.2)
- Microsoft.Data.SqlClient (>= 5.1.5)
- System.CommandLine (>= 2.0.0-beta4.22272.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 64 | 9/7/2026 |