EntityFrameworkCore.Generator 4.5.838

.NET 6.0
dotnet tool install --global EntityFrameworkCore.Generator --version 4.5.838
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 EntityFrameworkCore.Generator --version 4.5.838
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=EntityFrameworkCore.Generator&version=4.5.838
nuke :add-package EntityFrameworkCore.Generator --version 4.5.838


.NET Core command-line (CLI) tool to generate Entity Framework Core model from an existing database.


  • Entity Framework Core database first model generation
  • Safe regeneration via region replacement
  • Safe Renaming via mapping file parsing
  • Optionally generate read, create and update models from entity
  • Optionally generate validation and object mapper classes


Entity Framework Core Generator documentation is available via Read the Docs

Initialize Command

The initialize command is used to create the configuration yaml file and optionally set the connection string. The configuration file has many options to configure the generated output. See the configuration file documentation for more details.

The following command will create an initial generation.yaml configuration file as well as setting a user secret to store the connection string.

efg initialize -c <ConnectionString>

Replace <ConnectionString> with a valid database connection string.

When a generation.yaml configuration file exists, you can run efg generate in the same directory to generate the source using that configuration file.

Generate Command

Entity Framework Core Generator (efg) creates source code files from a database schema. To generate the files with the generation.yaml configuration, run the following

efg generate


Entity Framework Core Generator supports safe regeneration via region replacement and source code parsing. A typical workflow for a project requires many database changes and updates. Being able to regenerate the entities and associated files is a huge time saver.

Region Replacement

All the templates output a region on first generation. On future regeneration, only the regions are replaced. This keeps any other changes you've made to the source file.

Source Parsing

In order to capture and preserve Entity, Property and DbContext renames, the generate command parses any existing mapping and DbContext class to capture how things are named. This allows you to use the full extend of Visual Studio's refactoring tools to rename things as you like. Then, when regenerating, those changes won't be lost.

Database Providers

Entity Framework Core Generator supports the following databases.

  • SQL Server
  • PostgreSQL
  • MySQL
  • Sqlite
  • Oracle

The provider can be set via command line or via the configuration file.

View Models

Entity Framework Core Generator supports generating Read, Create and Update view models from an entity. Many projects rely on view models to shape data. The model templates can be used to quickly get the basic view models created. The model templates also support regeneration so any database change can easily be sync'd to the view models.

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
4.5.838 731 10/14/2022
4.5.726 2,157 3/6/2022
4.0.682 1,402 12/11/2021 612 10/21/2021 1,616 7/28/2021 451 7/12/2021 511 6/3/2021 1,300 2/15/2021 2,085 9/13/2020 492 8/28/2020 845 7/19/2020 631 6/27/2020 407 6/25/2020 383 6/25/2020 909 5/14/2020 704 4/19/2020 622 4/11/2020 582 3/17/2020 463 3/17/2020 585 2/24/2020 672 1/23/2020 762 12/20/2019 444 12/20/2019 684 12/3/2019 557 11/20/2019 838 10/9/2019 681 9/24/2019 589 9/17/2019 1,450 5/18/2019 526 5/16/2019 796 4/22/2019 642 3/29/2019 575 3/20/2019 632 2/27/2019 674 2/19/2019 860 12/6/2018 658 11/27/2018 723 11/26/2018 683 11/26/2018 656 11/26/2018 699 11/19/2018 653 11/14/2018 659 11/14/2018 671 11/14/2018 703 10/24/2018