Version: 1.0.0
Status: Production Ready 🚀
.NET 10 WPF desktop application that reverse-engineers SQL Server, MySQL, PostgreSQL, and SQLite databases into Entity Framework Core entities, DbContext, and Fluent API configurations.
Successor to pyPOCO with a single-process, WPF-native design, first-class EF Core output, and a modern 5-step wizard UX.
✨ Key Features:
- 🔄 Reverse-engineer SQL Server, MySQL, PostgreSQL, and SQLite databases to EF Core entities
- 🎨 Modern WPF UI with Fluent design (Mica, themes, wizard)
- 💾 Recent connections & saved profiles
- 🎯 Smart naming conventions (PascalCase, camelCase, snake_case)
- ⚙️ Fluent API configurations for complex mappings
- 🔍 Real-time syntax-highlighted C# preview
| Phase | Scope | Status |
|---|---|---|
| 0 | Foundations (solution, CPM, CI, DI host, arch tests) | ✅ complete |
| 1 | Vertical slice: connect → list tables → generate one entity to disk | ✅ complete |
| 2 | Full metadata & type mapping ([Key], [DatabaseGenerated], FK loading, composite-PK warning) |
✅ complete |
| 3 | Naming engine polish (namespace styling, extra Roslyn compile coverage) | ✅ complete |
| UI | WPF-UI Fluent chrome (Mica, dark/light/system theme, brand accent, multi-select tables, filter, schema selector) | ✅ complete |
| 4 | Templates + DbContext + Fluent configs (hand-rolled StringBuilder) |
✅ complete |
| 5 | Wizard UX (5 steps: Connection → Tables → Naming → Output → Preview with AvalonEdit) | ✅ complete |
| 6 | Existing-file protection (create/update/skip, partial classes) | ⏭️ skipped |
| 7 | Recent connections, saved profiles, generation history | ✅ complete |
| 8 | Hardening & release (packaging, distribution, docs) | ✅ complete |
116/116 unit tests pass. Build is clean (0 warnings, 0 errors).
Three distribution packages are available:
| Package | Size | Installation | Best For |
|---|---|---|---|
| Portable ZIP | 82 MB | None (extract & run) | Testing, USB drives, network shares |
| Inno Setup Installer | 56 MB | Traditional wizard | Permanent installations, enterprises |
| MSIX Package | 81 MB | Modern one-click | Microsoft Store, managed environments |
Download: See Releases page for latest downloads.
SHA-256 Checksums: Available in publish/CHECKSUMS.md for package verification.
# No installation required!
1. Download EntityClassGenerator-v1.0.0-Portable-win-x64.zip
2. Extract to any folder (e.g., C:\Tools\EntityClassGenerator)
3. Run EntityClassGenerator.App.exe# Traditional Windows installation
1. Download EntityClassGenerator-v1.0.0-Setup.exe
2. Double-click to run installer
3. Follow installation wizard
4. Launch from Start Menu: "Entity Class Generator"
# Silent installation (IT admins):
EntityClassGenerator-v1.0.0-Setup.exe /VERYSILENT /NORESTART# Modern Windows packaging
1. Download EntityClassGenerator-v1.0.0-Setup.msix
2. Double-click to install
3. Trust certificate if prompted (first-time only)
4. Launch from Start Menu📚 Complete installation guide: DISTRIBUTION.md
- Windows 10/11 (x64)
- .NET 10 SDK - Download
- Pinned via
global.jsonin repository
- Pinned via
- One supported database engine:
- SQL Server (local or remote) - Download SQL Server Express
- MySQL
- PostgreSQL
- SQLite
- Inno Setup 6.x - Download (free)
- Required for building
.exeinstaller - Install with default options
- Required for building
- Windows SDK - Download
- Required for building MSIX package
- Includes
makeappx.exeandsigntool.exe
# Clone repository
git clone https://github.com/yourusername/EntityClassGenerator.git
cd EntityClassGenerator
# Restore dependencies
dotnet restore EntityClassGenerator.slnx
# Build (Debug)
dotnet build EntityClassGenerator.slnx
# Build (Release)
dotnet build EntityClassGenerator.slnx -c Release
# Run tests (80 unit tests)
dotnet test EntityClassGenerator.slnx
# Run application
dotnet run --project src\EntityClassGenerator.App# No additional tools required - just .NET SDK
.\Build-Portable.ps1
# Output: publish/EntityClassGenerator-v1.0.0-Portable-win-x64.zip (82 MB)
# Contains: Self-contained .NET runtime, all dependencies, 544 files# Prerequisite: Install Inno Setup 6.x from https://jrsoftware.org/isdl.php
.\Build-InnoSetup.ps1
# Output: publish/EntityClassGenerator-v1.0.0-Setup.exe (56 MB)
# Features: Start Menu shortcuts, desktop icon, uninstaller, silent install# Prerequisite: Install Windows SDK from https://developer.microsoft.com/windows/downloads/windows-sdk/
.\Build-MSIX.ps1
# Output: publish/EntityClassGenerator-v1.0.0-Setup.msix (81 MB)
# Features: Modern packaging, auto-update support, Store-compatible
# Optional: Sign with test certificate
.\Build-MSIX.ps1 -Sign# Check build outputs
dir publish
# Verify checksums
cd publish
Get-FileHash *.zip, *.exe, *.msix -Algorithm SHA256📚 Complete build & packaging guide: DISTRIBUTION.md
- Launch the application
- Connection (Step 1): Choose a database engine and enter connection details
- Engine: SQL Server, MySQL, PostgreSQL, or SQLite
- Server/Database/Auth for server-based engines, or file path for SQLite
- SQL Server only: use Find Servers to discover visible instances
- SQL Server/MySQL/PostgreSQL: use Load Databases after entering server credentials
- Click "Test Connection"
- Tables (Step 2): Select tables to generate
- Filter by schema
- Use checkboxes to select tables
- "Select All Visible" for bulk selection
- Naming (Step 3): Configure naming conventions
- Choose case style: PascalCase, camelCase, snake_case
- Enable "Singularize class names" (recommended)
- Save as profile for reuse
- Output (Step 4): Choose output directory
- Select folder for generated files
- Enable "Use Fluent API" for advanced mappings
- Preview (Step 5): Review & generate
- Syntax-highlighted C# preview
- Click "Generate" to create files
Result: Entity classes, DbContext, and Fluent configurations in your output folder!
EntityClassGenerator/
├── src/
│ ├── EntityClassGenerator.Core/ # Domain models, interfaces, business rules
│ │ ├── Models/ # TableInfo, ColumnInfo, ForeignKeyInfo, etc.
│ │ ├── Abstractions/ # Interfaces (IEntityGenerator, etc.)
│ │ ├── Generation/ # Code generators (Entity, DbContext, Fluent)
│ │ ├── Naming/ # Naming conventions engine
│ │ └── TypeMapping/ # SQL → C# type mapping
│ ├── EntityClassGenerator.Infrastructure/ # Persistence, SQL metadata, file I/O
│ │ ├── SqlServer/ # SQL Server metadata + server discovery
│ │ ├── MySql/ # MySQL metadata reader
│ │ ├── PostgreSql/ # PostgreSQL metadata reader
│ │ ├── Sqlite/ # SQLite metadata reader
│ │ ├── FileSystem/ # File writing services
│ │ └── Persistence/ # JSON stores (connections, profiles)
│ ├── EntityClassGenerator.App/ # WPF UI, MVVM, DI host
│ │ ├── ViewModels/ # MainViewModel, WizardViewModel
│ │ ├── Views/ # WizardView, Step1-5 UserControls
│ │ ├── Converters/ # XAML value converters
│ │ └── App.xaml.cs # DI container setup
│ └── EntityClassGenerator.Tests/ # Unit & architecture tests (xUnit)
│ ├── Generation/ # Generator tests
│ ├── TypeMapping/ # Type parser and mapper tests
│ ├── Infrastructure/ # Infrastructure behavior tests
│ └── Architecture/ # Layer boundary tests
├── packaging/ # Distribution packaging
│ ├── innosetup/ # Inno Setup installer script
│ └── msix/ # MSIX package manifest
├── publish/ # Build outputs (generated)
│ ├── EntityClassGenerator-v1.0.0-Portable-win-x64.zip
│ ├── EntityClassGenerator-v1.0.0-Setup.exe
│ └── EntityClassGenerator-v1.0.0-Setup.msix
├── Build-Portable.ps1 # Build portable ZIP
├── Build-InnoSetup.ps1 # Build installer
├── Build-MSIX.ps1 # Build MSIX package
├── README.md # This file
├── DISTRIBUTION.md # Complete packaging guide
├── RELEASE_NOTES.md # v1.0.0 release notes
└── EntityClassGenerator.slnx # Solution file (.NET 10)
# Run full test suite (116 tests)
dotnet test EntityClassGenerator.slnx
# Run with detailed output
dotnet test EntityClassGenerator.slnx --verbosity detailed# Architecture tests (layer boundaries)
dotnet test --filter FullyQualifiedName~ArchitectureTests
# Entity generator tests (Roslyn compile verification)
dotnet test --filter FullyQualifiedName~EntityGeneratorTests
# DbContext & Fluent API tests
dotnet test --filter FullyQualifiedName~DbContextAndFluentTests
# Naming converter tests
dotnet test --filter FullyQualifiedName~NameConverterTests- ✅ 116/116 tests passing
- ✅ Roslyn compile verification - All generated code compiles against EF Core 9.0
- ✅ Architecture tests - Enforces layer boundaries (Core/Infrastructure don't reference WPF)
- ✅ Golden file tests - Deterministic output verification
# Run from command line
dotnet run --project src\EntityClassGenerator.App
# Or open in Visual Studio 2022 / Rider and F5 to debug# 1. Create feature branch
git checkout -b feature/my-new-feature
# 2. Make changes and test
dotnet build
dotnet test
# 3. Ensure no warnings
dotnet build EntityClassGenerator.slnx --warnaserror
# 4. Commit and push
git commit -m "Add new feature"
git push origin feature/my-new-feature- Zero warnings policy - Build configured with
TreatWarningsAsErrors - CA analyzers - Microsoft.CodeAnalysis.NetAnalyzers enforced
- EditorConfig - Consistent formatting across editors
- Nullable reference types -
#nullable enablethroughout
Generation
- SQL Server, MySQL, PostgreSQL, and SQLite → EF Core entity classes (one file per table).
- Independent naming conventions for class, namespace, property, and file
(Pascal / camel / snake / preserve). Namespace convention is applied per dotted
segment, with reserved-word segments (
class,namespace, …) automatically@-escaped. - Entity annotations:
#nullable enable,[Table("...")],[Column("...")],[Display(Name="...", Order=pos*10)],[Required],[StringLength(n)],[Key],[DatabaseGenerated(Identity)],[DatabaseGenerated(Computed)]. - Navigation properties — FK-side reference (nullable when all local
columns are nullable) plus inverse
ICollection<T>on the referenced entity. - NRT-aware: non-nullable reference-type properties are initialized with
= null!;. - Composite / missing PKs surface as generation warnings and are handled
by the Fluent generator (
HasKey/HasNoKey). DbContextgeneration — a partial class with oneDbSet<T>per selected table (deterministic order) andOnModelCreatingcallingApplyConfigurationsFromAssembly.- Fluent
IEntityTypeConfiguration<T>— emitted per table when needed:ToTable(name, schema)for non-default schemas (dbo/public/main),HasKey(x => new { … })for composite PKs,HasNoKeyfor keyless entities,HasPrecision(p, s)for decimal columns, andHasOne(...).WithMany(...).HasForeignKey(...).OnDelete(...)for every foreign key. - All output is Roslyn parse- and compile-verified against EF Core 9.0.0 + Relational in the test suite.
Metadata
- SQL Server
sys.*reader, MySQL/PostgreSQLinformation_schemareaders, and SQLitePRAGMAreader (async, cancellable). - Loads schemas, tables, columns (nullable, identity, computed, precision/scale, defaults), primary keys, and foreign keys (grouped by constraint, ordered, cascade-delete flag) across all supported engines.
UI (WPF + WPF-UI)
- 5-step wizard flow: Connection → Tables → Naming → Output → Preview
- Step indicator with visual feedback (active / completed / pending)
- Per-step validation guarding Next/Generate buttons
- Back/Next navigation preserved across steps
- SQL Server instance discovery via Find Servers
- SQL Server/MySQL/PostgreSQL database enumeration via Load Databases
- SQLite file selection via Browse…
- Recent Connections (Phase 7) — dropdown with last 10 used connections, auto-populated on select
- Saved Profiles (Phase 7) — save/load naming conventions and settings, with 2 built-in profiles ("EF Core Standard", "Preserve Names")
- AvalonEdit preview — syntax-highlighted C# code (Entity, DbContext, Fluent config snippets) with
// File: ...headers - Fluent-design
FluentWindowwith Mica backdrop and custom title bar. - Theme selector: System / Light / Dark. System uses
SystemThemeWatcherto follow OS changes live. - Brand palette: primary accent
#00B3F0(cyan), secondary#A6CE39(green), tertiary#F37021(orange). Applied viaApplicationAccentColorManager. - Multi-select tables
DataGridwith checkbox column, live text filter, schema selector, and Select all / Clear / Invert buttons. - Batch generation with progress bar, cancellation, and activity log.
When you enable "Use Fluent API" in Step 3 (Naming), the generator creates additional *Configuration.cs files in a Configurations/ subdirectory. These files use EF Core's Fluent API to configure advanced entity mappings that can't be expressed with simple data annotations.
Fluent API Configuration files are classes that implement IEntityTypeConfiguration<T>. They provide a clean, centralized way to configure how EF Core maps your entities to database tables.
Example:
// Configurations/OrderConfiguration.cs
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace YourNamespace;
public class OrderConfiguration : IEntityTypeConfiguration<Order>
{
public void Configure(EntityTypeBuilder<Order> builder)
{
builder.ToTable("Orders", "sales");
builder.HasKey(x => new { x.OrderId, x.LineNumber }); // Composite PK
builder.Property(x => x.TotalAmount)
.HasPrecision(18, 2); // Decimal precision
builder.HasOne(x => x.Customer)
.WithMany(x => x.Orders)
.HasForeignKey(x => x.CustomerId)
.OnDelete(DeleteBehavior.Cascade);
}
}Configuration files are only created when needed. A table gets a configuration file if it has:
- Composite primary key (
HasKey(x => new { ... })) - No primary key (
HasNoKey()for views/queries) - Non-
dboschema (ToTable(name, schema)) - Decimal columns with precision/scale (
HasPrecision(p, s)) - Foreign key relationships (
HasOne/WithMany/HasForeignKey)
Simple tables with a single integer PK in the dbo schema get no configuration file - they use data annotations only.
Your DbContext automatically discovers and applies all configurations via:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
}This scans the assembly for all IEntityTypeConfiguration<T> classes and applies them automatically. You don't need to manually register each one.
| Scenario | Data Annotations | Fluent API |
|---|---|---|
| Simple PK | ✅ [Key] |
✅ HasKey(x => x.Id) |
| Composite PK | ❌ Not possible | ✅ HasKey(x => new { x.A, x.B }) |
| String length | ✅ [StringLength(50)] |
✅ HasMaxLength(50) |
| Decimal precision | ❌ Not possible | ✅ HasPrecision(18, 2) |
| Foreign keys | ✅ Full control (cascade, restrict, etc.) | |
| Schema mapping | ✅ [Table("T", Schema="s")] |
✅ ToTable("T", "s") |
Fluent API advantages:
- ✅ Keeps entity classes clean - no attribute clutter
- ✅ More powerful - can express complex scenarios
- ✅ Better separation - entities focus on domain logic, configs focus on persistence
- ✅ Easier to maintain - all DB mapping in one place per entity
Option 1: Uncheck "Use Fluent API" in Step 3 (Naming). The generator will use data annotations only.
Option 2: Delete the Configurations/ folder and remove the ApplyConfigurationsFromAssembly call from your DbContext. Then manually configure everything via attributes on your entity classes.
OnModelCreating for these cases.
- Official EF Core docs: Creating and Configuring a Model
- Fluent API reference: Entity Type Configuration
- IEntityTypeConfiguration: Grouping Configuration
- Relationships: Configure Relationships
| Document | Description |
|---|---|
| README.md | This file - project overview, build, and installation |
| DISTRIBUTION.md | Complete packaging and distribution guide |
| RELEASE_NOTES.md | v1.0.0 release notes and feature highlights |
| project-instructions.md | Original product specification |
| BUILD_SUCCESS.md | Build session summary |
| PACKAGING_SUMMARY.md | Packaging work details |
| publish/CHECKSUMS.md | SHA-256 checksums for packages |
┌─────────────────────────────────────┐
│ EntityClassGenerator.App │ ← WPF UI, ViewModels, DI host
│ (Presentation Layer) │
└────────────┬────────────────────────┘
│ references
▼
┌─────────────────────────────────────┐
│ EntityClassGenerator.Infrastructure│ ← SQL metadata, file I/O, persistence
│ (Infrastructure Layer) │
└────────────┬────────────────────────┘
│ references
▼
┌─────────────────────────────────────┐
│ EntityClassGenerator.Core │ ← Domain models, interfaces, generators
│ (Domain Layer - no dependencies) │
└─────────────────────────────────────┘
Enforced by ArchitectureTests:
- ✅
CoreandInfrastructurenever reference WPF assemblies- No
PresentationCore,PresentationFramework,WindowsBase, orWPF-UI - Ensures domain logic is UI-agnostic
- No
- ✅ WPF-specific code lives exclusively in
Appproject - ✅ Dependency flow: App → Infrastructure → Core (never reversed)
- MVVM (Model-View-ViewModel) - via
CommunityToolkit.Mvvm - Dependency Injection -
Microsoft.Extensions.DependencyInjection - Repository Pattern -
IDatabaseMetadataReader,IFileWriter - Strategy Pattern -
IEntityGenerator,ITypeMapper - Observer Pattern -
INotifyPropertyChanged,ObservableCollection<T>
| Category | Technology | Version |
|---|---|---|
| Runtime | .NET | 10.0 |
| UI Framework | WPF | Built-in |
| UI Library | WPF-UI | 4.0.3 |
| Code Editor | AvalonEdit | 6.4.0 |
| MVVM | CommunityToolkit.Mvvm | 8.4.0 |
| Database | Microsoft.Data.SqlClient | 6.1.0 |
| Dependency Injection | Microsoft.Extensions.DependencyInjection | 10.0 |
| Logging | Microsoft.Extensions.Logging | 10.0 |
| Configuration | Microsoft.Extensions.Configuration | 10.0 |
| Testing | xUnit | 2.9.3 |
| Roslyn | Microsoft.CodeAnalysis.CSharp | 4.12.0 |
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for new functionality
- Ensure all tests pass (
dotnet test) - Ensure no build warnings (
dotnet build --warnaserror) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code conventions (EditorConfig)
- Use meaningful variable names
- Add XML documentation for public APIs
- Keep methods focused and testable
Open Source - See LICENSE file for details.
Built with amazing open-source libraries:
- WPF-UI by @lepoco - Modern Fluent design for WPF
- AvalonEdit by @icsharpcode - Syntax-highlighting code editor
- CommunityToolkit.Mvvm by Microsoft - MVVM source generators
- Inno Setup by @jrsoftware - Windows installer creation
Special thanks to the .NET and EF Core teams for excellent tooling!
- Repository: GitHub
- Issues: Report bugs
- Releases: Download latest
- Discussions: Q&A and feedback
- SQL Server reverse engineering
- MySQL reverse engineering
- PostgreSQL reverse engineering
- SQLite reverse engineering
- EF Core entity generation
- DbContext generation
- Fluent API configurations
- 5-step wizard UI
- Recent connections & profiles
- Distribution packages
- SQL Server server discovery
- Server database listing (SQL Server/MySQL/PostgreSQL)
- Repository pattern generation
- Unit test scaffolding
- CLI mode (headless operation)
- Azure AD / Entra ID authentication
Made with ❤️ using .NET 10, WPF, and Entity Framework Core
Last updated: 2026-08-04