Pluralization for Entity Framework Core

Jimmy Engström


Pluralization for Entity Framework Core

I recently started working with .NET Core and I didn’t like that Microsoft removed the automatic pluralization/singularization of classes and collection in Entity Framework Core. They did however give us the opportunity to hook in our own. This is talked about in this StackOverflow post

What you need to do is to add a couple of files to your Entity Framework Core project.

I created a folder named “Pluralize” and added a PluralizationService. I choose to modify the one Microsoft provided in previous versions of Entity Framework found here.
You can of course just create your own. These are the files I use:

This will automatically register MyPluralizer and it will be used the next time you update your Entity Framework model.

Hope this helps you and if you have any feedback, please contact me.

Posted with :