I've only ever used the custom HttpApplication and writing code for the BeginRequest and EndRequest events. Try that and see if it works.
--- Patrick Steele http://weblogs.asp.net/psteele On Sun, Apr 17, 2011 at 12:34 PM, Larry Zhao <[email protected]> wrote: > Thanks guy, I found the problem. > Since I am using Castle ActiveRecord 3.0, the SessionScopeWebModule in > compiled in Castle.ActiveRecord.Web. > So I changed to include: > <add name="ARScope" > type="Castle.ActiveRecord.Framework.SessionScopeWebModule, > Castle.ActiveRecord.Web"/> > Then the SessionScopeWebModule is included without error. > But the lazy load session closed problem still exists on some properties, > it's weird. > Regards. > > Larry > > > On Mon, Apr 18, 2011 at 12:03 AM, Larry Zhao <[email protected]> > wrote: >> >> Thanks a lot Patrick. >> Does that mean I just simply include : >> >> <add >> name="ar.sessionscope" >> type="Castle.ActiveRecord.Framework.SessionScopeWebModule, >> Castle.ActiveRecord" /> >> >> in my <httpModules> in the web.config, then I will have SessionScope per >> Request feature? >> I actually tried that before, and I got the following error: >> Could not load type 'Castle.ActiveRecord.Framework.SessionScopeWebModule' >> from assembly 'Castle.ActiveRecord'. >> (C:\D\Development\workspaces\asp.net\BaiJiPortal\Web\web.config line 96) >> Is there any other code that I need to add beside the xml configuration? >> Thanks again for the help. >> Regards. >> >> Larry >> >> >> On Sun, Apr 17, 2011 at 11:22 PM, Patrick Steele >> <[email protected]> wrote: >>> >>> http://docs.castleproject.org/Active%20Record.Web%20applications.ashx >>> >>> --- >>> Patrick Steele >>> http://weblogs.asp.net/psteele >>> >>> >>> >>> On Sun, Apr 17, 2011 at 6:30 AM, Larry Zhao <[email protected]> >>> wrote: >>> > Hi, Everyone, >>> > >>> > I am using castleactiverecord in Web Project. And I am having headache >>> > with >>> > the famous Lazy Loading error: >>> > >>> > Initializing[User#2]-failed to lazily initialize a collection of role: >>> > User.HostingActivities, no session or session was closed >>> > >>> > I did search through stackoverflow and found that there're two >>> > solutions: >>> > >>> > Implement a ThreadScopeInfo of my own. from blog "The >>> > Darksid": http://tinyurl.com/3mscdw4 -- but this seems not suitable for >>> > Web >>> > app. >>> > >>> > using ISession.Lock() to reattach the object, before calling any Lazy >>> > Load >>> > Property. -- this is fine if I manually do that every time. >>> > >>> > is there a central solution for this in Web app? That means I don't >>> > need to >>> > do ISession.Lock() everytime when using Lazy Load properties? >>> > >>> > Because I am also using other libraries and they will also sometimes >>> > call >>> > lazy load property and I could not modify all the places of the code in >>> > libraries. >>> > >>> > Need help. Thanks! >>> > >>> > Regards. >>> > >>> > Larry >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> > Groups >>> > "Castle Project Users" 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/castle-project-users?hl=en. >>> > >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Castle Project Users" 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/castle-project-users?hl=en. >>> >> > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" 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/castle-project-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en.
