![]() |
VOOZH | about |
dotnet add package EntityFrameworkRuler.Editor --version 10.0.7
NuGet\Install-Package EntityFrameworkRuler.Editor -Version 10.0.7
<PackageReference Include="EntityFrameworkRuler.Editor" Version="10.0.7" />
<PackageVersion Include="EntityFrameworkRuler.Editor" Version="10.0.7" />Directory.Packages.props
<PackageReference Include="EntityFrameworkRuler.Editor" />Project file
paket add EntityFrameworkRuler.Editor --version 10.0.7
#r "nuget: EntityFrameworkRuler.Editor, 10.0.7"
#:package EntityFrameworkRuler.Editor@10.0.7
#addin nuget:?package=EntityFrameworkRuler.Editor&version=10.0.7Install as a Cake Addin
#tool nuget:?package=EntityFrameworkRuler.Editor&version=10.0.7Install as a Cake Tool
Automate the customization of the EF Core Reverse Engineered model. Features include:
EF Ruler applies customizations from a rule document stored in the project folder. Rules can be initialized with a call to ef dbcontext scaffold, or they can be fully generated from an EDMX such that the scaffolding output will align with the old EF6 EDMX-based model.
"EF Ruler provides a smooth upgrade path from EF6 to EF Core by ensuring that the Reverse Engineered model maps perfectly from the old EDMX structure."
By default, a rule file generated from EDMX limits tables and columns to just what was in the EDMX. That way, an identical model can be generated.
If it's time to add a table or column to the model, adjust the IncludeUnknownTables or IncludeUnknownColumns flags at the relevant level.
If the database schema contains a lot of tables that you don't want to generate entities for, then enabling IncludeUnknownTables is not a good idea. Instead, manually create the table entry in the rule file (using the Editor) and set IncludeUnknownColumns to true. On the next scaffold, the new entity will be generated fully.
You can remove entities from the model by marking the corresponding table (or column) as Not Mapped.
The ef dbcontext scaffold command does not natively support splitting entity type configurations into separate files. Instead, all type configurations are stored in the same file as the context.
With EF Core 7 and later, EntityFrameworkRuler.Design can split configurations for you.
Just enable "SplitEntityTypeConfigurations" in the rule file (at the root level).
> dotnet tool install --global EntityFrameworkRuler --version <the latest version>
See the NuGet page for details.
> efruler -g <edmxFilePath> <efCoreProjectBasePath>
If both paths are the same, i.e. the EDMX is in the EF Core project folder, it is acceptable to run:
> efruler -g <projectFolderWithEdmx>
DB context rules will be extracted from the EDMX and saved in the EF Core project folder.
It is strongly recommended to just run ef dbcontext scaffold with the EntityFrameworkRuler.Design library referenced in order to apply customizations. However, if this is not an option, the following command can apply renaming and type mapping to existing entities (using Roslyn). For very large projects, this can take a minute.
> efruler -a <efCoreProjectBasePath>
While the command line tool, EntityFrameworkRuler.Design package, and VS Extension are intended to provide all the features necessary to customize the reverse engineered model, without writing any code, the API is available and fully extensible if you need to tailor the process further.
Reference NuGet package EntityFrameworkRuler.Common
serviceCollection
.AddRuler()
.AddSingleton<IRuleSerializer, MyBinaryRuleSerializer>()
.AddTransient<IRulerNamingService, MyCustomNamingService>()
.AddTransient<IEdmxParser, MyEdmxParser>()
var generator = new RuleGenerator(); // or use injected IRuleGenerator instance
var response = generator.GenerateRules(edmxPath);
if (response.Success)
await generator.SaveRules(response.Rules.First(), projectBasePath);
var applicator = new RuleApplicator(); // or use injected IRuleApplicator instance
var response = await applicator.ApplyRulesInProjectPath(projectBasePath);
var generator = new RuleGenerator();
var response = generator.GenerateRules(edmxPath);
if (response.Success)
await generator.SaveRules(projectBasePath, dbContextRulesFile: "DbContextRules.json", response.Rules.First());
var applicator = new RuleApplicator();
applicator.Log += (sender, message) => Console.WriteLine(message);
var response = await applicator.ApplyRulesInProjectPath(projectBasePath);
This project is under development! Check back often, and leave comments here.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 net6.0-windows7.0 is compatible. net7.0-windows net7.0-windows was computed. net8.0-windows net8.0-windows was computed. net9.0-windows net9.0-windows was computed. net10.0-windows net10.0-windows was computed. |
| .NET Framework | net48 net48 is compatible. net481 net481 was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.7 | 143 | 2/27/2026 |
| 10.0.7-alpha.0.2 | 71 | 2/27/2026 |
| 10.0.7-alpha.0.1 | 71 | 2/27/2026 |
| 10.0.6 | 130 | 2/27/2026 |
| 10.0.5 | 134 | 2/19/2026 |
| 10.0.4 | 132 | 2/17/2026 |
| 10.0.3 | 135 | 2/17/2026 |
| 10.0.2 | 127 | 2/16/2026 |
| 10.0.2-alpha.0.2 | 76 | 2/16/2026 |
| 10.0.2-alpha.0.1 | 64 | 2/16/2026 |
| 10.0.1 | 116 | 2/16/2026 |
| 10.0.1-alpha.0.1 | 79 | 2/16/2026 |
| 10.0.0 | 128 | 2/16/2026 |
| 9.0.6 | 134 | 2/16/2026 |
| 9.0.5 | 124 | 2/16/2026 |
| 9.0.3-alpha.0.7 | 188 | 11/3/2025 |
| 9.0.3-alpha.0.6 | 191 | 11/3/2025 |
| 9.0.3-alpha.0.5 | 179 | 11/3/2025 |
| 9.0.2 | 255 | 11/29/2024 |
| 9.0.1 | 242 | 11/21/2024 |