title: Using T4 Templates for ENum's
body: <p>I've reached a confusing part of my development for my applications.</p>
  
  <p>I am using a custom attribute for authentication called "Allowed For" which then uses user types.</p>
  
  <p>For example by method would have the data annotation <code>[Allowfor(UserType.Admin)]</code> but the problem I am having is i want to store a list of UserTypes in the database which the following properties:</p>
  
  <ul>
  <li>Id</li>
  <li>Deleted</li>
  <li>Name</li>
  <li>Desc</li>
  </ul>
  
  <p>So at runtime or even at a click of a button I would like to build an Enum class holding a list of the non deleted Enum's.</p>
  
  <p>Could anyone swing some advice my way regarding this as I can't seem to do it my self and not able to find much help googling.</p>
  
  <p>I just need to know the following things:</p>
  
  <ul>
  <li>How to use T4 Templates or something similar to create a class in VS 2013</li>
  <li>How to get it to this at the start of every build/or my pressing a button in the UI</li>
  <li>Any database look up preferably using a string in the web config file or using DbContext(EF if possible)</li>
  </ul>