session.Lock or Merge; Merge if the entity was saved in some moment.
btw there are some other options to manage that situation without use
HttpSession

2009/10/29 Mohamed Meligy <[email protected]>

> This mostly applies to web applications.
> Let's say I have an object "ShoppingCart" that is persisted both in HTTP
> SessionState and Database for some reason (let's say we want the user to
> find the cart available if he leaves the site and comes back later). Every
> time the user adds a "Product" to the "ShoppingCart", we want to add it to
> the "SessionState"  already laoded in HTTP SessionState and then we save the
> "ShoppingCart" i dataabase.
>
> *We want to avoid loading the "ShoppingCart" from the database when we
> want to change some proprty or add some related object when we already have
> it loaded in HTTP SessionState,* but we are also using the typical "Single
> NHibernate ISession per HTTP Request" pattern, meaning the "ShoppingCart" is
> loaded from one NH ISession and changed in other different NH ISessions
> (since saved in HTTP SessionState, which is maintained across multiple HTTP
> Requests).
> *Will it be possible to have the object loaded from different NH ISession
> to be saved usig another ISession?*
>
> In Linq To Sql and Entity Framework you can theoretically Detach ad
> Re-Attach entity to different Data/Entity Context. I LLBLGen (Adapter not
> Self Servcing, cause the latter is just ACtiveRecord) the entity is
> generated with all required Proxy functionality that makes it self tracking
> making it easy to use without attaching to cetain Adapter.
> How about in NHibernate?
>
> Regards,
>
> --
> Mohamed Meligy
> Information Analyst (.Net Technologies) – Applications Delivery - TDG
> Injazat Data Systems
> P.O. Box: 8230 Abu Dhabi, UAE.
>
> Phone:  +971 2 6992700
> Direct:   +971 2 4045385
> Mobile:  +971 50 2623624, +971 55 2017 621
>
> E-mail: [email protected]
> Weblog: http://weblogs.asp.net/meligy
>
> >
>


-- 
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]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to