tags:

views:

46

answers:

1

I'm just getting started with NHibernate and reading blogs and articles from all over. many of them reference a session.Get<> methods for generic types, but this is not available for me. I only get the session.Get(Type class, object id) methods.

Why is this? Am I missing a reference? Or has this something to do with the NHibernate version I'm using. Wich is NHIbernate 2.1.0

+1  A: 

Given the following definition, they're implemented by the ISession interface. Which would mean that whenever you have an object which implements ISession, you should have both methods.

namespace NHibernate
{
    public interface ISession : IDisposable
    {
        ...
        T Get<T>(object id);
        object Get(string entityName, object id);
    }
}

Are you sure you have the most recent version of the NHibernate assembly?

Stephan
I downloaded the latest release tonight.this is mye exmaple code:public Person GetByPersonId(Guid personId){ ISessionFactory sessionFactory = (new Configuration()).Configure().BuildSessionFactory(); ISession session = sessionFactory.OpenSession(); return (Person) session.Get(typeof (Person), personId);}this is the only .Get method I'm able to access. I have only referenced the NHibernate.dll
Kulvis