Initialize the session factory on first call to OpenSession(). Or via
an explicit method call. Or arrange this part of you program in some
other way.

/Oskar


2009/10/23 crazyprogrammer <[email protected]>:
>
> Recently,I have read the book "nhibernate in action".In its chapter
> 10, there is a NHibernateHelper class,its content is
> as follow:
>    class NHibernateHelper
>    {
>        public static readonly ISessionFactory Sessionfactory;
>        static NHibernateHelper()
>        {
>            try
>            {
>                Configuration cfg = new Configuration();
>                Sessionfactory = cfg.Configure().BuildSessionFactory
> ();
>            }
>            catch (Exception ex)
>            {
>                Console.Error.WriteLine(ex);
>                throw new Exception("NHibernate initialization
> failed", ex);
>            }
>        }
>        public static ISession OpenSession()
>        {
>            return Sessionfactory.OpenSession();
>        }
>    }
>
> I like this class,but I want to pass an assembly before Calling the
> BuildSessionFactory().This Class's static constructor can not receive
> a parameter. How can I do?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to