Search code examples
entity-frameworkef-code-firstef-core-3.0

Migration didn't pluralize table name


I added a simple class MemberModel and added the following to my database context class:

public DBSet<MemberModel> Member { get; set; }

After adding migration and updating the database, the table name generated is Member and not Members. Where did I go wrong?


Solution

  • EF Core will use the name of the DbSet property. Rename Member to Members should result in a Members table.

    public DBSet<MemberModel> Members { get; set; }
    

    more info https://github.com/aspnet/Announcements/issues/167