This project is a working sample that adds design-time pluralization to Entity Framework Core.
To use the package, simply install it. The pluralizer will be used when reverse engineering a model from an existing database.
dotnet add package Bricelam.EntityFrameworkCore.Pluralizer
dotnet ef dbcontext scaffold "Data Source=chinook.db" Microsoft.EntityFrameworkCore.Sqlite
Install-Package Bricelam.EntityFrameworkCore.Pluralizer
Scaffold-DbContext 'Data Source=chinook.db' Microsoft.EntityFrameworkCore.Sqlite
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.