EntityFrameworkRuler.Common
1.0.29-alpha.0.48
Prefix Reserved
See the version list below for details.
dotnet add package EntityFrameworkRuler.Common --version 1.0.29-alpha.0.48
NuGet\Install-Package EntityFrameworkRuler.Common -Version 1.0.29-alpha.0.48
<PackageReference Include="EntityFrameworkRuler.Common" Version="1.0.29-alpha.0.48" />
paket add EntityFrameworkRuler.Common --version 1.0.29-alpha.0.48
#r "nuget: EntityFrameworkRuler.Common, 1.0.29-alpha.0.48"
// Install EntityFrameworkRuler.Common as a Cake Addin #addin nuget:?package=EntityFrameworkRuler.Common&version=1.0.29-alpha.0.48&prerelease // Install EntityFrameworkRuler.Common as a Cake Tool #tool nuget:?package=EntityFrameworkRuler.Common&version=1.0.29-alpha.0.48&prerelease
Entity Framework Ruler - Common
Automate the customization of the EF Core Reverse Engineered model. Supported changes include:
- Class renaming
- Property renaming (including both primitives and navigations)
- Type changing (useful for enum mapping)
- Skipping non-mapped columns.
- Forcing inclusion of simple many-to-many entities into the model.
EF Ruler applies customizations from a rule document stored in the project folder. Rules can be fully generated from an EDMX (from old Entity Framework) 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."
Upgrading from EF6 couldn't be simpler:
- The the CLI tool to analyze the EDMX for all customizations and generate the rules.
- Reference EntityFrameworkRuler.Design from the EF Core project.
- Run the ef dbcontext scaffold command and the design-time service will do the rest.
Done.
Applying Model Customizations:
There are two options for applying the rules to a DB context model:
- Simply reference EntityFrameworkRuler.Design from the EF Core project. Proceed with CLI scaffolding (as mentioned above). EntityFrameworkRuler.Design is a Design-Time reference package, meaning EF Core can use it during the scaffolding process to customize the generated model, but the assembly will NOT appear in the project build output. It can't get more automated than this.
- Use the CLI tool to apply changes to an already generated EF Core model. This approach uses Roslyn to apply code changes. The code analysis is reliable, but for very large models this option can take a minute.
Road Map:
- EF Power Tools built-in support.
- Editor library to manage the rules and edit the EF Core model structure with a UI.
This project is under development! Check back often, and leave comments here.
Installation of the CLI tool:
There are 2 ways to use the CLI tool:
- Command line:
> dotnet tool install --global EntityFrameworkRuler
- API:
> dotnet add package EntityFrameworkRuler PM> NuGet\Install-Package EntityFrameworkRuler
See the NuGet page for details.
CLI Usage:
To generate rules from an EDMX, run the following:
> 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>
Structure rules will be extracted from the EDMX and saved in the EF Core project folder.
To Apply rules to an already generated EF Core model:
> efruler -a <efCoreProjectBasePath>
This assumes that you have executed the ef dbcontext scaffold command to generate the model previously.
API Usage
To generate rules from an EDMX, use the following class:
EntityFrameworkRuler.Generator.RuleGenerator
To Apply rules to an existing EF Core model, use the following class:
EntityFrameworkRuler.Applicator.RuleApplicator
Examples
Generate and save rules:
var generator = new RuleGenerator();
var response = generator.GenerateRules(edmxPath);
if (response.Success)
await generator.SaveRules(response.Rules.First(), projectBasePath);
Apply rules already in project path:
var applicator = new RuleApplicator();
var response = await applicator.ApplyRulesInProjectPath(projectBasePath);
More control over which rules are applied:
var applicator = new RuleApplicator();
var loadResponse = await applicator.LoadRulesInProjectPath(projectBasePath);
var applyResponse = await applicator.ApplyRules(projectBasePath, loadResponse.Rules.First());
Customize rule file name:
var generator = new RuleGenerator();
var response = generator.GenerateRules(edmxPath);
if (response.Success)
await generator.SaveRules(projectBasePath, dbContextRulesFile: "DbContextRules.json", response.Rules.First());
Handle log activity:
var applicator = new RuleApplicator();
applicator.Log += (sender, message) => Console.WriteLine(message);
var response = await applicator.ApplyRulesInProjectPath(projectBasePath);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Humanizer.Core (>= 2.14.1)
- Microsoft.Bcl.HashCode (>= 1.1.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Text.Json (>= 6.0.0)
-
net6.0
- Humanizer.Core (>= 2.14.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
NuGet packages (2)
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 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.3.48 | 160 | 9/28/2024 |
1.3.46 | 183 | 8/27/2024 |
1.3.46-alpha.0.1 | 41 | 8/27/2024 |
1.3.45 | 241 | 5/2/2024 |
1.3.44 | 80 | 5/2/2024 |
1.3.43 | 90 | 5/2/2024 |
1.3.42 | 88 | 5/2/2024 |
1.3.40 | 202 | 4/4/2024 |
1.3.9-alpha.0.1 | 63 | 4/4/2024 |
1.3.8 | 203 | 3/21/2024 |
1.3.7 | 189 | 3/21/2024 |
1.3.6 | 562 | 12/19/2023 |
1.3.5 | 454 | 11/29/2023 |
1.3.4 | 441 | 11/18/2023 |
1.2.40 | 571 | 10/26/2023 |
1.2.39 | 455 | 10/25/2023 |
1.2.38 | 426 | 10/24/2023 |
1.2.37 | 441 | 10/23/2023 |
1.2.36 | 914 | 7/17/2023 |
1.2.34-alpha.0.2 | 85 | 7/14/2023 |
1.2.33 | 636 | 7/12/2023 |
1.2.30 | 606 | 6/22/2023 |
1.2.30-alpha.0.1 | 91 | 6/21/2023 |
1.2.29-alpha.0.1 | 73 | 6/20/2023 |
1.2.28 | 667 | 6/20/2023 |
1.2.27 | 1,696 | 4/18/2023 |
1.2.26 | 832 | 3/23/2023 |
1.2.25 | 766 | 3/16/2023 |
1.2.22 | 701 | 3/7/2023 |
1.2.21 | 745 | 3/6/2023 |
1.2.21-alpha.0.4 | 93 | 3/6/2023 |
1.2.19 | 796 | 2/14/2023 |
1.2.19-alpha.0.4 | 100 | 2/14/2023 |
1.2.17 | 785 | 1/31/2023 |
1.2.16 | 857 | 1/27/2023 |
1.2.15 | 794 | 1/27/2023 |
1.2.14 | 816 | 1/26/2023 |
1.2.13 | 825 | 1/25/2023 |
1.2.10 | 844 | 1/25/2023 |
1.2.9 | 819 | 1/25/2023 |
1.2.8 | 790 | 1/25/2023 |
1.2.7 | 801 | 1/24/2023 |
1.2.6 | 808 | 1/24/2023 |
1.2.5 | 724 | 1/24/2023 |
1.2.4 | 703 | 1/18/2023 |
1.2.3 | 757 | 1/17/2023 |
1.2.3-alpha.0.1 | 110 | 1/9/2023 |
1.2.2 | 795 | 1/9/2023 |
1.2.1-alpha.0.2 | 110 | 1/6/2023 |
1.2.0 | 840 | 1/5/2023 |
1.1.8-alpha.0.16.4 | 108 | 1/5/2023 |
1.1.8-alpha.0.16.2 | 120 | 1/5/2023 |
1.1.8-alpha.0.16.1 | 118 | 1/5/2023 |
1.1.8-alpha.0.16 | 119 | 1/5/2023 |
1.1.8-alpha.0.15 | 116 | 1/4/2023 |
1.1.7 | 869 | 12/14/2022 |
1.1.6-alpha.0.5 | 99 | 12/14/2022 |
1.1.6-alpha.0.4 | 99 | 12/13/2022 |
1.1.6-alpha.0.2 | 102 | 12/13/2022 |
1.1.6-alpha.0.1 | 94 | 12/13/2022 |
1.1.5 | 865 | 12/9/2022 |
1.1.3 | 836 | 12/8/2022 |
1.1.3-alpha.0.2 | 97 | 12/8/2022 |
1.1.3-alpha.0.1 | 99 | 12/8/2022 |
1.1.2 | 851 | 12/8/2022 |
1.1.1 | 797 | 12/7/2022 |
1.1.0 | 824 | 12/6/2022 |
1.0.29-alpha.0.50 | 107 | 12/6/2022 |
1.0.29-alpha.0.48 | 100 | 12/6/2022 |
1.0.29-alpha.0.44 | 98 | 12/6/2022 |
1.0.28 | 866 | 11/18/2022 |
1.0.27 | 885 | 11/18/2022 |
1.0.26 | 868 | 11/18/2022 |
1.0.25 | 822 | 11/18/2022 |
1.0.22 | 878 | 11/17/2022 |
1.0.21 | 916 | 11/17/2022 |
1.0.20 | 898 | 11/16/2022 |
1.0.19 | 872 | 11/16/2022 |
1.0.18 | 856 | 11/16/2022 |
1.0.16 | 862 | 11/15/2022 |
1.0.13 | 867 | 11/15/2022 |