CHC.EF.Reverse.Poco
1.3.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global CHC.EF.Reverse.Poco --version 1.3.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.3.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CHC.EF.Reverse.Poco&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package CHC.EF.Reverse.Poco --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
This project is licensed under the MIT License.
Release Notes
- v1.0.0: Initial CLI release
- Added command line interface
- Support for multiple configuration sources
- Improved error handling and feedback
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.