A .NET Global Tool for reverse engineering databases to Entity Framework Core models
$ dotnet add package CHC.EF.Reverse.PocoThis .NET Global Tool streamlines the creation of Entity Framework Core models from your existing database schema. By intelligently analyzing your database structure, it automatically generates clean, efficient C# code for your data access layer.
Ensure you have the .NET 8 SDK installed. Then, install the tool globally using:
dotnet tool install --global CHC.EF.Reverse.Poco
Generate your models with a single command:
efrev --connection "your_connection_string" --provider "your_provider_name" --output "your_output_directory"
Options:
--connection: Your database connection string.--provider: The database provider (SqlServer/MySql/PostgreSql).--output: The directory for generated code.--pluralize: Pluralize table names (default: true).--data-annotations: Use data annotations (default: true).Example:
efrev --connection "Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;" --provider SqlServer --output "C:\MyProject\Models"
Fine-tune the code generation process using an appsettings.json file:
{
"CodeGenerator": {
"ConnectionString": "your_connection_string",
"ProviderName": "your_provider_name",
"Namespace": "your_namespace",
"OutputDirectory": "your_output_directory",
"IsPluralize": true,
"UseDataAnnotations": true
}
}
dotnet build
dotnet testMIT License
Contributions are welcome! Feel free to submit pull requests or report issues on GitHub.
This tool is built on the shoulders of giants, leveraging the power of Entity Framework Core and the .NET ecosystem.