hello! on my way to nhibernate i finished studying basic tutorial for introduction to it.Now i'm about to try a project with 3 tables/classes (let's not tald about mapping for now) currency| country | denomination.The challenge and what is confusing is the part of building a session.In fact i have a static function that return the session.
Code:
class NHibernateHelper
{
private static ISessionFactory _isessionFactory;
private static ISessionFactory SessionFactory
{
get
{
if (_isessionFactory == null)
{
Configuration cfg = new Configuration().Configure().AddAssembly(typeof(Currency).Assembly);
_isessionFactory = cfg.BuildSessionFactory();
}
return _isessionFactory;
}
set { _isessionFactory = value; }
}
public static ISession OpenSession()
{
return SessionFactory.OpenSession();
}
}
i've read on the documentation
Quote:
Another alternative (probably the best) way is to let NHibernate load all of the mapping files contained in an Assembly:
Configuration cfg = new Configuration()
.AddAssembly( "NHibernate.Auction" );
would that mean that i dont' have to add classes like Country and Denomination as in
Code:
Configuration cfg = new Configuration().Configure().AddAssembly(typeof(Currency).Assembly)
.AddAssembly(typeof(Country).Assembly)
.AddAssembly(typeof(Denomination).Assembly);
am i in the wrong path?thanks for reading this