![]() |
VOOZH | about |
dotnet add package EntityFrameworkRuler.Common --version 10.0.7
NuGet\Install-Package EntityFrameworkRuler.Common -Version 10.0.7
<PackageReference Include="EntityFrameworkRuler.Common" Version="10.0.7" />
<PackageVersion Include="EntityFrameworkRuler.Common" Version="10.0.7" />Directory.Packages.props
<PackageReference Include="EntityFrameworkRuler.Common" />Project file
paket add EntityFrameworkRuler.Common --version 10.0.7
#r "nuget: EntityFrameworkRuler.Common, 10.0.7"
#:package EntityFrameworkRuler.Common@10.0.7
#addin nuget:?package=EntityFrameworkRuler.Common&version=10.0.7Install as a Cake Addin
#tool nuget:?package=EntityFrameworkRuler.Common&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 | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on EntityFrameworkRuler.Common:
| Package | Downloads |
|---|---|
|
EntityFrameworkRuler.Design
Automatically applies customization of the EF Core Reverse Engineered model during the scaffold process. |
|
|
EntityFrameworkRuler.Editor
EDMX support for EF Core: Generate customization rules from EF6 EDMX file and apply to EF Core model |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.7 | 208 | 2/27/2026 |
| 10.0.7-alpha.0.2 | 75 | 2/27/2026 |
| 10.0.7-alpha.0.1 | 67 | 2/27/2026 |
| 10.0.6 | 150 | 2/27/2026 |
| 10.0.5 | 178 | 2/19/2026 |
| 10.0.4 | 170 | 2/17/2026 |
| 10.0.3 | 154 | 2/17/2026 |
| 10.0.2 | 160 | 2/16/2026 |
| 10.0.2-alpha.0.2 | 70 | 2/16/2026 |
| 10.0.2-alpha.0.1 | 64 | 2/16/2026 |
| 10.0.1 | 133 | 2/16/2026 |
| 10.0.1-alpha.0.1 | 81 | 2/16/2026 |
| 10.0.0 | 128 | 2/16/2026 |
| 9.0.6 | 129 | 2/16/2026 |
| 9.0.5 | 126 | 2/16/2026 |
| 9.0.3-alpha.0.7 | 199 | 11/3/2025 |
| 9.0.3-alpha.0.6 | 191 | 11/3/2025 |
| 9.0.3-alpha.0.5 | 194 | 11/3/2025 |
| 9.0.2 | 1,642 | 11/29/2024 |
| 9.0.1 | 378 | 11/21/2024 |