It is in NHibernate.Expression.

For your problem: If HMBase doesn't include anything that should be
persisted, leave the [ActiveRecord] away. If you need to persist it's
contents, read the article on mapping hierarchies in the docs.

-Markus

2009/7/5 Jiggr <[email protected]>

>
> Thanks Tuna!
>
> In which namespace to you find Restrictions?
>
> On 5 Juli, 19:49, Tuna Toksoz <[email protected]> wrote:
> > 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_toksozhttp://tunatoksoz.comhttp://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?- Dölj
> citerad text -
> >
> > - Visa citerad text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to