there are a number of reasons why your application is running slow
after switching to NH. as mentioned above having a single session
factory and using session per request will move you in the right
direction.  another problem is most likely the amount of data your
query and/or the number of queries executed.  For that a tool like
NHProf will help locate the bottlenecks.

On Aug 19, 7:34 am, Gustavo Ringel <[email protected]> wrote:
> In general you are not supposed to open a session every time you need it,
> but you should have a session opened at the beggining of the request and
> closed at the end of the request.
>
> you may check the web modules in uNHAddins, or the session management in
> Castle or in Rhino, in short you should change the way you are managing the
> session if you want to keep
>
> Gustavo.
>
> On Thu, Aug 19, 2010 at 2:23 PM, osman nuri katib
> <[email protected]>wrote:
>
> > while binding Part List in a aspx file
> >             using (ISession session = NHibernateHelper.OpenSession())
> >             {
> >                 IList<Part> myList;
> >                 myList = session.CreateCriteria<Part>().List<Part>();
> >                 gvPart.DataSource=myList;
> >             }
> >  and my NHibernateHelper class:
>
> >     [Serializable]
> >     public class NHibernateHelper
> >     {
> >         private static ISessionFactory _sessionFactory;
> >         private static ISessionFactory SessionFactory
> >         {
> >             get
> >             {
> >                 if (_sessionFactory == null)
> >                 {
> >                     var configuration = new Configuration();
> >                     configuration.Configure();
> >                     configuration.AddAssembly("RYS");
> >                     _sessionFactory = configuration.BuildSessionFactory();
> >                 } return _sessionFactory;
> >             }
> >         }
> >         public static ISession OpenSession()
> >         {
> >             return SessionFactory.OpenSession();
> >         }
> >     }
>
> > 2010/8/19 Gustavo Ringel <[email protected]>
>
> >  Fabio means that if you feel fine with Linq2SQL and you find problems
> >> moving to NH then it may be better for you to stay in Linq.
>
> >> But in general no one in this list feels that nhibernate is slow when
> >> building the session factory once and using a session-per-request strategy.
>
> >> Probably you are failing in doing it right. The snippet of code you sent
> >> isn't enough to understand how you are working with NH.
>
> >> Gustavo.
>
> >> 2010/8/19 osman nuri katib <[email protected]>
>
> >> Fabio, Is this a solution:)
>
> >>> 19 Ağustos 2010 14:02 tarihinde Fabio Maulo <[email protected]>yazdı:
>
> >>> then don't converts your app. and keep on linq2sql
>
> >>>>  On Thu, Aug 19, 2010 at 5:57 AM, osman nuri katib <
> >>>> [email protected]> wrote:
>
> >>>>>   I'm converting a web application based LINQ to NHibernate.But
> >>>>> nhibernate is too slow.
> >>>>> How can I accelerate it. In aspx file I'm using like this:
>
> >>>>> using(ISession session=NHibernateHelper.OpenSession())
> >>>>> {
> >>>>> //code
> >>>>> }
>
> >>>>> before run command I'm generating a session.Is this true?
> >>>>> help please?
>
> >>>>> --
> >>>>> Osman Nuri KATİB
> >>>>>        YTÜ
> >>>>> Bilgisayar Mühendisliği
>
> >>>>> --
> >>>>>   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]<nhusers%[email protected]>
> >>>>> .
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/nhusers?hl=en.
>
> >>>> --
> >>>> Fabio Maulo
>
> >>>> --
> >>>>  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]<nhusers%[email protected]>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/nhusers?hl=en.
>
> >>> --
> >>> Osman Nuri KATİB
> >>>        YTÜ
> >>> Bilgisayar Mühendisliği
>
> >>> --
> >>> 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]<nhusers%[email protected]>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/nhusers?hl=en.
>
> >>   --
> >> 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]<nhusers%[email protected]>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > Osman Nuri KATİB
> >        YTÜ
> > Bilgisayar Mühendisliği
>
> > --
> > 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]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

-- 
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