title: Mapping DB values to Enum
body: <p>I created a new <code>Enum</code> class from db table <code>Role</code> which has <code>RoleId</code> and <code>RoleType</code>. </p>
  
  <pre><code>public enum UserType
  {
      Student = 1,
      Teacher = 4
      Admin = 5 
  }
  </code></pre>
  
  <p>Here 1,4,5 are RoleId(Primary Key) from db. What i did is i looked manually for the db primary key value for each role and mapped that to <code>enum</code>.</p>
  
  <p>The demerit here is every time i need to update the <code>enum</code> class when db <code>RoleId</code> Changes.</p>
  
  <p>Is there any other standard practice to map db values as <code>enum</code> collections?</p>
  
  <p>Any suggestions will help</p>