title: How to create a table corresponding to enum in EF6 Code First?
body: <p>I've followed <a href="https://msdn.microsoft.com/en-us/data/hh859576.aspx" rel="noreferrer">MSDN</a> on how to handle enumerations in Code First for EF6. It worked, as supposed to <strong>but</strong> the field in the created table that refers to the enumerator is a simple <em>int</em>.</p>
  
  <p>I'd prefer a second table to be produced, the values of which would follow the definition of the enumerator in C# code. So, instead of only getting a table corresponding to <em>Department</em> in the example on MSDN, I'd also like to see a second table populated by the items from <em>Faculty</em>.</p>
  
  <pre><code>public enum Faculty { Eng, Math, Eco }     
  
  public partial class Department 
  { 
    [Key] public Guid ID { get; set; } 
    [Required] public Faculty Name { get; set; } 
  }
  </code></pre>
  
  <p>Researching the issue, I stumbled upon a <a href="http://gentlelogic.blogspot.se/2014/07/ef-code-first-create-table-out-of-enum.html" rel="noreferrer">solution</a>, which suggests creating a table for the enumeration and populating it explicitly by seeding. </p>
  
  <p>It appear to me as a cumbersome approach and a lot of work that should be handled automagically. After all, the system knows what actual values that constitute the enumeration. From DB point of view it's still data rows, just as the entities that I create but from OO aspect, it's not really a data - rather a type (loosely expressed) that can assume a finite and onbeforehand known number of states.</p>
  
  <p>Is the approach of populating the table "manually" recommended?</p>