Hello? if you resolve this problem, write to me.
I have the same problem.
суббота, 7 марта 2009 г., 13:08:58 UTC+8 пользователь Dargor написал:
>
> Hello every one,
>
> I have been using nhibernate for a few months and learned a whole lot
> through this time (like how to set it up to work in medium trust
> environments). However today while uploading my application to my
> shared hosting environment I got the following error:
>
> Session factory does not implement ISessionFactoryImplementor.
>
> I am currently using NHibernate in a ASP.NET application with the
> following property for Session Context :
>
> <property name="current_session_context_class">web</property>
>
> As in most examples in the web I have a NHibernateHelper class with
> the following code:
>
> public static class NHibernateHelper
> {
> private static ISessionFactory _sessionFactory = null;
>
> // Lock synchronization object
> private static object _syncLock = new object();
>
> //private static void NHibernate()
> //{
> //}
>
> /// <summary>
> /// Opens a NHibernate Session using a configuration
> file.
> /// </summary>
> /// <param name="configFile">Path to the configuration
> file used for
> this session</param>
> /// <returns>ISession object</returns>
> /// <exception cref="ZiblerDataLayerUtilitiesException"/
> >
> /// <remarks>If no session has been created a new
> session will be
> open.
> /// Otherwise the existing session will be returned.</
> remarks>
> public static ISession OpenSession(string configFile)
> {
> // Support multithreaded applications through
> // 'Double checked locking' pattern which (once
> // the instance exists) avoids locking each
> // time the method is invoked
> if (_sessionFactory == null)
> {
> lock (_syncLock)
> {
> if (_sessionFactory == null)
> {
> try
> {
> Configuration
> cfg = new Configuration();
> _sessionFactory
> = cfg.Configure(@configFile).BuildSessionFactory
> ();
>
> //if
> (SessionFactory == null)
> // throw new
> Exception("MARIO NULL");
>
> }
> catch
> (HibernateException e)
> {
> throw new
> ZiblerDataLayerUtilitiesOpenSessionException
> (Resources.OpenSessionExceptionMessage, e);
> }
> catch (Exception e)
> {
> throw new
> ZiblerDataLayerUtilitiesUnknownException
> (Resources.UnknownExceptionMessage, e);
> }
>
> }
> }
> }
>
> return _sessionFactory.OpenSession();
> }
>
> /// <summary>
> /// Returns the current session
> /// </summary>
> /// <returns>Current session</returns>
> public static ISession GetCurrentSession()
> {
> return _sessionFactory.GetCurrentSession();
> }
>
> /// <summary>
> /// Returns the current Session Factory
> /// </summary>
> public static ISessionFactory SessionFactory
> {
> get { return _sessionFactory; }
> }
>
> }
>
>
> So basically the architecture of my application is a conversation by
> request, in which I bind the session to the request at the beginning
> and unbind it at the end. It is when I unbind that this problem
> appears. When I unbind I have to pass the SessionFactoy (retrieved
> from the NHibernateHelper class) to the Nhibernate
> CurrentSessionContext.Unbind method. What I notice is that when I get
> the Session Factory from the NhibernateHelper class, it is always
> null. I know it is not a mapping issue since it works in my
> development environment.
>
> Note that the class shown above is a static class that all my http
> requests use when opening a session. However I have come to realize
> that because it is static, it gets loaded into the aspnet process in
> the server, and it won't be unloaded until this process is rebooted.
>
> I have a feeling that the reason for this problem is because of this,
> however I don't have the ability to reboot the aspnet process since
> this is a shared hosting, and I do need to update my app constantly
> (specially during development). Any ideas????? Hope you can help.
>
> Thanks in advance
>
> Mario
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.