How to use enums in tables in entityframework core? RRS feed

  • Question

  • User1655654435 posted

    Hi, I want to specify a type for my movie collection. And i'm thinking about using an enum to set a category.

    Is it common to use enums in sql to represent a group of categories to sort through(quickly)? I would think it would be faster than using string property.

    Will the enum be represented in the database as numbers? 

    How do i represent it in the model for entity framework?

    public enum MyEnum
        comedy, horror, action
    then in the db model:
    public MyEnum Foo { get; set; }

    Monday, April 29, 2019 1:24 PM

All replies