I know this is not the standard that is to use singular class names. But the thing is that we have many microservices which are using an old version of Entity Framework and the standard decided internally is to use plural names for auto-generated code of the Scaffolding.
I'm actually working on a .NET 6 project which includes EF Core 6.0.6 and I need to generate those cloases on a DB First approach to be plural:
What I have:
public partial class DeliveryDbContext : DbContext
{
public DeliveryDbContext()
{
}
public DeliveryDbContext(DbContextOptions<DeliveryDbContext> options)
: base(options)
{
}
public virtual DbSet<Deliverable> Deliverables { get; set; }
public virtual DbSet<DeliverableDeliveryMethod> DeliverableDeliveryMethods { get; set; }
...
What I need:
public partial class DeliveryDbContext : DbContext
{
public DeliveryDbContext()
{
}
public DeliveryDbContext(DbContextOptions<DeliveryDbContext> options)
: base(options)
{
}
public virtual DbSet<Deliverables> Deliverables { get; set; }
public virtual DbSet<DeliverableDeliveryMethods> DeliverableDeliveryMethods { get; set; }
...
As you can see the only difference is the trailing "s" at the at of the class name.
This is the scaffold command that I'm running:
Scaffold-DbContext -Project "Knowfully.Delivery.Data" -StartupProject "Knowfully.Delivery.Data" "Server=.;Database=delivery-db;Trusted_Connection=True;Integrated Security=true;MultipleActiveResultSets=true;" Microsoft.EntityFrameworkCore.SqlServer -Context DeliveryDbContext -ContextDir . -OutputDir Entities -Force
I have read multiple posts and none of them helped me out. Some suggest to implement a pluralizer service and others mentioned a package Bricelam.EntityFrameworkCore.Pluralizer but it didn't work or I don't understand how to use it properly.
How can I do this?