Not an answer to your question, but anyway instead of using new NHibernate.Expression.EqExpression() you can say Restrictions.Eq()
Tuna Toksöz Eternal sunshine of the open source mind. http://devlicio.us/blogs/tuna_toksoz http://tunatoksoz.com http://twitter.com/tehlike On Sun, Jul 5, 2009 at 8:45 PM, Jiggr <[email protected]> wrote: > > I am trying to do a method that checks if the username and password to > a user is correct from a login form. > > I have wrote this code to get all users with all that username and > password that the user has entered from the web form. > --- > HMUser[] hmUser = (HMUser[]) HMUser.FindAll(new > NHibernate.Expression.ICriterion[] { > new NHibernate.Expression.EqExpression("UserName", > txtUsername), > new NHibernate.Expression.EqExpression("Password", > txtPassword.Text) > }); > --- > > For me it seems to be ok. There are lot of characters to do a task > like that, does it exists a better way to do the same thing? Of course > I can write "using NHibernate.Expression;" and things like that in the > top of the file to get rid of all namespaces. > > When I call the code above I always get this exception: > --- > You have accessed an ActiveRecord class that wasn't properly > initialized. The only explanation is that the call to > ActiveRecordStarter.Initialize() didn't include HMBackend.BaseHM > class > --- > > I dont understand why. :( Because in my global.asax-file in the > Application_Start-method I have added BaseHM to my Initialize call. > > I can describe my system quick; all my business object inherits from > HMBase. > > For example this is my HMBase.cs: > --- > ... > > namespace HMBackend > { > [ActiveRecord] > abstract public class BaseHM : ActiveRecordBase<BaseHM> > { > ... > } > } > --- > > And this is my HMUser.cs > --- > ... > > namespace HMBackend > { > [ActiveRecord] > public class HMUser : BaseHM > { > ... > } > } > --- > > Is there an connection between the exception and my inheritance? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
