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; }
Member
168 Points
201 Posts
How to use enums in tables in entityframework core?
Apr 29, 2019 01:24 PM|bluMarmalade|LINK
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?
All-Star
53051 Points
23634 Posts
Re: How to use enums in tables in entityframework core?
Apr 29, 2019 01:29 PM|mgebhard|LINK
The EF docs cover this topic.
https://docs.microsoft.com/en-us/ef/core/modeling/value-conversions