I would suggest moving all methods of this nature into IRepository objects, and using the ActiveRecordMediator<T> base, rather than ActiveRecordBase<T>.
http://www.castleproject.org/ActiveRecord/documentation/trunk/advanced/media tor.html This provides better SOC. -----Original Message----- From: JakeS [mailto:[email protected]] Sent: Saturday, November 21, 2009 7:45 AM To: Castle Project Users Subject: Re: Castle ActiveRecord -- How to determine Session Errors No, I didn't catch any exceptions. And there is no stack-trace, since I didn't see the actual error anywhere, it was occuring in the OnEndRequest of the http request. I eventually tracked down the issue -- it had to do with Databinding accessing properties on an object. Those properties did lookups to find data, and the object had not been saved yet. Something like this-- public IList<Projects> GetActiveProjects { get { return Projects.FindAll( Restrictions.Eq("Owner", this), Restrictions.Eq("Status", ProjectStatus.Active) ); } } So databinding would access this property (even though it wasn't actually being used anywhere on the view) before the object was actually saved. And I couldn't find any way to tell if the object was saved or prevent access to this property by the databinder. All I could do was put in an ugly hack that checks for an Id of 0-- public IList<Projects> GetActiveProjects { get { if(this.Id==0){return null;} return Projects.FindAll( Restrictions.Eq("Owner", this), Restrictions.Eq("Status", ProjectStatus.Active) ); } } I must be doing something fundamentally wrong. On Nov 20, 1:05 pm, Markus Zywitza <[email protected]> wrote: > Did you catch any exceptions? What is the stacktrace? > > -Markus > > 2009/11/19 JakeS <[email protected]>: > > > I'm still struggling a lot with my data models. My database schema is > > now turning out the way I'd like (I think), but now the site is not > > saving any data! I perform a simple step that should insert a row > > into a table and it gets rolled-back. I watched on NHProf and see the > > INSERT statements entering -- and they are valid, then at the end it > > simply says "rollback transaction". > > > I'm using the "Session per Request" pattern I found here-- > >http://using.castleproject.org/display/AR/Enable+Session+per+Request. > > In the OnEndRequest event the scope.HasSessionError is true. But how > > do I find out what the error actually is? > > > -- > > > 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 athttp://groups.google.com/group/castle-project-users?hl=. > > -- 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=. -- 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=.
