Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pluralize collections when performing scaffold dbcontext?

I performed a scaffold dbcontext and everything is fine exception the collections aren't pluralized. Is there an argument I can add to the command to fix this?

This is the command I ran:

dotnet ef dbcontext scaffold "my connection string" 
Microsoft.EntityFrameworkCore.SqlServer -o Entities -c DbEntities

What I want:

public partial class Client
{
    public int Id { get; set; }
    public ICollection<Order> Orders { get; set; }
}

What I'm getting:

public partial class Client
{
    public int Id { get; set; }
    public ICollection<Order> Order { get; set; }
}
like image 821
Tong Avatar asked Oct 16 '25 19:10

Tong


1 Answers

Have you looked at this plugin?

https://www.bricelam.net/2018/03/02/efcore-pluralization.html

like image 68
howardlo Avatar answered Oct 18 '25 14:10

howardlo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!