0

I am learning Entity Framework Code First. I have created a model class named 'Category', after running update-database i find that EF name the class 'Categories'. My Model is as Follwoing.

public class Category
{
  [Key]
  public int Id { get; set; }

  [StringLength(maximumLength:50)]
  public string Name { get; set; }
}
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
Jaydeep Karena
  • 159
  • 1
  • 5
  • 14
  • 1
    What is your question? – Igor Jun 05 '17 at 14:39
  • 1
    You forgot to ask anything or describe an issue. –  Jun 05 '17 at 14:41
  • 1
    EF pluralizes table names by default. You can change that setting globally or individually. See [here](https://stackoverflow.com/questions/4796543/how-do-i-singularize-my-tables-in-ef-code-first). – Steve Greene Jun 05 '17 at 14:43
  • 2
    Possible duplicate of [How do I singularize my tables in EF Code First?](https://stackoverflow.com/questions/4796543/how-do-i-singularize-my-tables-in-ef-code-first) – Fran Jun 05 '17 at 14:43
  • There are a ton of articles + other SO posts about this. But, we can't really help you because we don't know if this convention is a problem for you. – Grizzly Jun 05 '17 at 14:45

1 Answers1

1

Entity Framework relies on various naming conventions used by the data context to understand the conceptual model. The entity name will be singular and the data set name will be plural, automatic migrations will create the table name as plural following the same convention.

Mark Redman
  • 24,079
  • 20
  • 92
  • 147