CHC.EF.Reverse.Poco 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global CHC.EF.Reverse.Poco --version 1.2.0
                    
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 CHC.EF.Reverse.Poco --version 1.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CHC.EF.Reverse.Poco&version=1.2.0
                    
nuke :add-package CHC.EF.Reverse.Poco --version 1.2.0
                    

EF Core Reverse Engineering Tool

.NET 8.0 code generator for Entity Framework 6.0, creating POCO classes, configurations, and DbContext from existing databases.

Features

Database Schema Support

  • Comprehensive schema reading for SQL Server and MySQL
  • Advanced relationship mapping:
    • One-to-One with unique constraint detection
    • One-to-Many with collection navigation
    • Many-to-Many with junction table support
  • Column property handling:
    • Custom data types and constraints
    • Computed columns and generated values
    • Collation and encoding settings
  • Index and key management:
    • Composite primary/foreign keys
    • Unique and clustered indexes
    • Filtered indexes (SQL Server)

Code Generation

  • Clean POCO entities with relationship navigation
  • Fluent API configurations
  • Documented DbContext
  • XML documentation from schema comments

Configuration Options

  • Multiple config sources (CLI, JSON files)
  • Provider selection (SQL Server/MySQL)
  • Output customization
  • Pluralization options

Installation

dotnet tool install --global CHC.EF.Reverse.Poco

Required packages:

dotnet add package Microsoft.EntityFrameworkCore
dotnet add package Microsoft.EntityFrameworkCore.SqlServer # For SQL Server
dotnet add package MySql.EntityFrameworkCore # For MySQL

Usage

Initialize config:

efrev --init

Basic usage:

efrev -c "connection-string" -p "provider-name"

Options

-c, --connection        Connection string
-p, --provider         Provider (SqlServer/MySql)
-n, --namespace        Target namespace
-o, --output           Output directory
--pluralize            Pluralize collection names
--data-annotations     Use data annotations
--config              Custom config path
--settings            Settings file path
--init                Create config files

Configuration

appsettings.json:

{
  "CodeGenerator": {
    "ConnectionString": "Server=localhost;Database=YourDb;",
    "ProviderName": "Microsoft.Data.SqlClient",
    "Namespace": "YourApp.Data",
    "DbContextName": "AppDbContext",
    "UseDataAnnotations": true,
    "IncludeComments": true,
    "IsPluralize": true,
    "OutputDirectory": "./Generated"
  }
}

Output Examples

Entity:

public class Order
{
    public int Id { get; set; }
    public int CustomerId { get; set; }
    
    public virtual Customer Customer { get; set; }
    public virtual ICollection<OrderDetail> Details { get; set; }
}

Configuration:

modelBuilder.Entity<Order>(entity =>
{
    entity.ToTable("Orders");
    entity.HasKey(e => e.Id);
    
    entity.HasOne(e => e.Customer)
          .WithMany(e => e.Orders)
          .HasForeignKey(e => e.CustomerId);
});

License

<<<<<<< HEAD MIT License

MIT License

74733467271f27f2bc8de812f51aac510e17d619

Product 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. 
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
3.0.0 171 4 months ago
2.1.0 126 4 months ago
2.0.0 140 4 months ago
1.5.0 117 4 months ago
1.4.0 126 4 months ago
1.3.0 122 4 months ago
1.2.0 136 4 months ago
1.1.0 128 4 months ago
1.0.0 137 4 months ago