Reputation: 83
The table is not being named in the DB as it supposed to be named. Here is the context:
ApplicationDBContext:
public IDbSet<Artwork> Artwork { get; set; }
In the database, the table should be named Artwork, but instead of that it is named Artworks(I had it named like this before, but now when I'm trying to name it just Artwork, its still "Artworks"). I've tried to drop and create it again and nothing happens. Can someone explain me the situation why this is occuring?
Thank you,
Marius J.
Upvotes: 1
Views: 28
Reputation: 49095
By default, Entity Framework uses the Pluralizing Table Name Convention to set table names.
You can remove it in the OnModelCreating
method though:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
Or map the table name explicitly:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Artwork>().ToTable("Artwork");
}
Upvotes: 2