I am writing a BaseDAO for a c#.net application that uses nHibernate. I am having trouble making use of session.get in a generic manner, so that it can be utilized by my other DAOs.
I currently have something like this:
protected Task get(int id)
{
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
return session.Get(typeof(Task), 1) as Task;
}
I want to change this so that it will operate on any of my Persistant objects, i.e not just Task, i want to do something like pass in the Persistant class into the method and then this gets used in the 'get' method.
But im a little unsure how to do this, any suggestions?
|