You can use more than one method to query ActiveRecord:

HQL, DetachedCriteria,

NHibernate Query Generator I think is the easiest:
http://ayende.com/Blog/archive/2006/10/14/NHibernateQueryGenerator15IsDoneTimeWithMagic.aspx

But I suggest Linq2NHibernate:
http://mhinze.com/linq-to-nhibernate-in-10-minutes/
http://ayende.com/Blog/archive/2007/03/17/Implementing-Linq-for-NHibernate-A-How-To-Guide--Part.aspx
http://trycatchfail.com/blog/post/2008/08/19/Using-LINQ-with-ActiveRecord.aspx

Follow NHibernate Contrib Google group for more information.

Hope this help

On 23 Mar, 17:58, Colin Ramsay <[email protected]> wrote:
> http://www.hibernate.org/hib_docs/nhibernate/html/querycriteria.html#...http://www.google.co.uk/search?q=castle+activerecord+findall+icriteria
>
> You need to use something like:
>
>    DetachedCriteria crit = DetachedCriteria.For(typeof (Subscriber))
>       .CreateAlias("SubscriberType", "type")
>       .Add(Expression.Eq("type", "Fitness"))
>
> subscriberList = Subscriber.FindAll(order, crit);
>
> I have little Active Record experience, but since FindAll will take a
> DetachedCriteria (seemingly), all of the NHibernate documentation
> applies, and there is plenty of guidance on that.
>
> On Sun, Mar 22, 2009 at 8:55 PM, Mark Roberts <[email protected]> wrote:
>
> > I have spent literally hours today Googling for even basic query
> > examples for Castle ActiveRecord, and have frustratingly come-up with
> > nothing. The VERY basic basics, like simple FindAll(), finding a
> > single record by its key, and all that, is quite simple. But it seems
> > once I'm a single step beyond that, I'm getting absolutely nowhere.
>
> > So with that, I have two questions:
>
> > 1. Is there a good web resource that shows a range of common query
> > scenarios and how they're coded, since the documentation doesn't seem
> > to cover the subject?  (And neither, it seems, is there much coverage
> > of ICriterion[] from the NHibernate side.)
>
> > 2. In particular, how to do you use ICriterion-based queries to filter
> > by values in a table joined with BelongsTo? I have a domain object of
> > Subscriber with a BelongsTo property pointing to a SubscriberType
> > object. I want to FindAll( ) the subscribers of a particular
> > SubscriberType, but this construct doesn't work:
>
> >                criterion = new ICriterion[] {
> >                    Expression.Eq("SubscriberType.Description",
> > "Fitness")
> >                };
> >                subscriberList = Subscriber.FindAll(order, criterion);
>
> > (Note that "order" is defined separately, elsewhere.)
>
> > That comes back with a runtime error of, "could not resolve property:
> > SubscriberType.Description of: Subscriber"
>
> > I've got to be missing something pretty simple, but all my Googling
> > is, as I said, returning nothing useful.
>
> > Thanks for any direction anyone can provide on this.
--~--~---------~--~----~------------~-------~--~----~
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