This should be fixed now. On Sat, Dec 27, 2008 at 4:21 PM, Ayende Rahien <[email protected]> wrote:
> This is a bug with NH's handling of TransactionScope. > You can workaround this bug by not explicitly disposing of the session. > It sucks, I know, but that is the best until we fix the bug. > > > On Sat, Dec 27, 2008 at 2:40 PM, Hadi <[email protected]> wrote: > >> >> Hello, >> >> I'm trying to use NHibernate + Rhino ESB but as soon as I hit the >> database in my consumer class an exception is thrown. my consumer >> class is simple as this : >> >> public class ShipmentSaga : ConsumerOf<NewOrder> >> { >> public const int PackageLimit = 5; >> >> public ShipmentSaga(IServiceBus bus) >> { >> this.Bus = bus; >> } >> >> public IServiceBus Bus >> { >> get; >> private set; >> } >> >> public void Consume(NewOrder orderMessage) >> { >> var packagefull = HasEnoughOrders(); >> if(packagefull) >> { >> Bus.Send(new ShipmentLargeEnough); >> } >> } >> >> public bool HasEnoughOrders() >> { >> using(var session = IoC.Resolve<ISessionFactory> >> ().OpenSession()) >> { >> IList todayOrders = session.CreateCriteria(typeof >> (Order)) >> .Add(Expression.Eq >> ("OrderDate", DateTime.Now.Date)) >> .Add(Expression.Eq >> ("IsShipped", false)) >> .List(); >> >> return todayOrders.Count >= PackageLimit; >> } >> } >> } >> >> but as soon as the execution for HasEnoughOrders is finished an >> exception is thrown. Ayende says : "The problem is that NH register >> the session for the DTC transaction, but it is not defering disposal >> properly the way it should" but is there a workaround? is there an >> existing ticket for this to be fixed in later nhibernate releases? >> >> Thanks >> Hadi >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" 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/rhino-tools-dev?hl=en -~----------~----~----~----~------~----~------~--~---
