title: Mapping enum with fluent nhibernate
body: <p>I am following the <a href="http://wiki.fluentnhibernate.org/Getting_started" rel="noreferrer">http://wiki.fluentnhibernate.org/Getting_started</a> tutorial to create my first NHibernate project with Fluent NHibernate</p>
  
  <p>I have 2 tables</p>
  
  <p>1) Account with fields</p>
  
  <pre><code>Id
  AccountHolderName
  AccountTypeId
  </code></pre>
  
  <p>2) AccountType with fields</p>
  
  <pre><code>Id
  AccountTypeName
  </code></pre>
  
  <p>Right now the account types can be Savings or Current
  So the table AccountTypes stores 2 rows
  1 - Savings
  2 - Current</p>
  
  <p>For AccoutType table I have defined enum</p>
  
  <pre><code>public enum AccountType {
      Savings=1,
      Current=2
  }
  </code></pre>
  
  <p>For Account table I define the entity class</p>
  
  <pre><code>public class Account {
      public virtual int Id {get; private set;}
      public virtual string AccountHolderName {get; set;}
      public virtual string AccountType {get; set;}
  }
  </code></pre>
  
  <p>The fluent nhibernate mappings are:</p>
  
  <pre><code>public AgencyMap() {
      Id(o =&gt; o.Id);
      Map(o =&gt; o.AccountHolderName);
      Map(o =&gt; o.AccountType);
  }
  </code></pre>
  
  <p>When I try to run the solution, it gives an exception - InnerException = {"(XmlDocument)(2,4): XML validation error: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of possible elements expected: 'meta, subselect, cache, synchronize, comment, tuplizer, id, composite-id' in namespace 'ur...</p>
  
  <p>I guess that is because I have not speciofied any mapping for AccountType.</p>
  
  <p>The questions are:</p>
  
  <ol>
  <li>How can I use AccountType enum
  instead of a AccountType class?</li>
  <li>Maybe I am going on wrong track. Is there a better way to do this?</li>
  </ol>
  
  <p>Thanks!</p>