title: C# Entity Framework Core store enum using native enum datatype
body: <p>I am using Entity Framework Code with Code First development approach and a PostgreSQL Database. One of my classes has a enum property. This works out quite well.</p>
  <p>However, when I took a look at the database I noticed that in the database the enum was actually stored as an integer, not as an enum as I had expected. So if you now directly query data from the database, you only see the integer and you have no clue what it means.</p>
  <p>I have seen <a href="https://codewithshadman.com/entity-framework-enum-code-first/" rel="nofollow noreferrer">here</a> and <a href="https://medium.com/agilix/entity-framework-core-enums-ee0f8f4063f2" rel="nofollow noreferrer">here</a> that you can use a lookup table or store the enum as string to circumvent this, but this seems a bit unnatural IMHO, considering that you could also just could store the enum in the database.</p>
  <p>So is there any way to store enums as <a href="https://www.postgresql.org/docs/9.1/datatype-enum.html" rel="nofollow noreferrer">enum datatype</a> in the database? If no, why not?</p>