title: NHibernate 2.0: What is the correct EntityMode: POCO, Map or Xml
body: <p>I am using some NHibernate 1.2 code with NHibernate 2.0 and its giving me an issue with this line:</p>
  
  <pre><code>return (TId) entityMeta.GetIdentifier(entity);
  </code></pre>
  
  <p>its asking me to add EntityMode: POCO, Map or Xml</p>
  
  <pre><code>return (TId) entityMeta.GetIdentifier(entity, EntityMode.Map);
  </code></pre>
  
  <p>But which mode is the correct one to use?</p>
  
  <hr>
  
  <p>Here is the whole method:</p>
  
  <pre><code>public TId GetId&lt;TId&gt;(TEntity entity)
  {
      ISessionFactory sessionFactory = NHibernateSessionManager.Instance.GetSessionFactoryFor(assembly);
  
      if (sessionFactory == null)
      {
          sessionFactory = NHibernateSessionManager.Instance.GetSessionFactoryFor(GetNHibernateConfig());
      }
  
      IClassMetadata entityMeta = sessionFactory.GetClassMetadata(typeof(TEntity));
  
      return (TId) entityMeta.GetIdentifier(entity, EntityMode.Map);
  }
  </code></pre>