Skip to content
Adds design-time pluralization to EF Core
C# PowerShell Batchfile
Branch: master
Clone or download
Pull request Compare This branch is even with bricelam:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
EFCore.Pluralizer.Test
EFCore.Pluralizer
tools
.gitattributes
.gitignore
EFCore.Pluralizer.sln
LICENSE
NuGet.Config
README.md
build.cake
build.cmd
build.ps1

README.md

Bricelam.EntityFrameworkCore.Pluralizer

This project is a working sample that adds design-time pluralization to Entity Framework Core.

Usage

To use the package, simply install it. The pluralizer will be used when reverse engineering a model from an existing database.

Console:

dotnet add package Bricelam.EntityFrameworkCore.Pluralizer
dotnet ef dbcontext scaffold "Data Source=chinook.db" Microsoft.EntityFrameworkCore.Sqlite

PMC:

Install-Package Bricelam.EntityFrameworkCore.Pluralizer
Scaffold-DbContext 'Data Source=chinook.db' Microsoft.EntityFrameworkCore.Sqlite

How it works

On install, the package adds an assembly-level attribute to the project:

[assembly: DesignTimeServicesReference(
    "Bricelam.EntityFrameworkCore.Design.EFCorePluralizerServices, Bricelam.EntityFrameworkCore.Pluralizer")]

This attribute points to a class that registers the IPluralizer service.

class EFCorePluralizerServices : IDesignTimeServices
{
    public void ConfigureDesignTimeServices(IServiceCollection services)
        => services.AddSingleton<IPluralizer, Pluralizer>();
}

At design time, EF Core will find the assembly-level attribute and call the ConfigureDesignTimeServies method to register additional services.

You can’t perform that action at this time.