tags:

views:

847

answers:

1

Hello

I am using some NHibernate 1.2 code with NHibernate 2.0 and its giving me an issue with this line:

return (TId) entityMeta.GetIdentifier(entity);

its asking me to add EntityMode: POCO, Map or Xml

return (TId) entityMeta.GetIdentifier(entity, EntityMode.Map);

But which mode is the correct one to use?


Here is the whole method:

public TId GetId<TId>(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);
}
A: 

You need to use EntityMode.POCO, more info found on this blog

Sathish Naga