Great! This works. I just got a little bit lost in criteria of criteria of
criteria and ordering on other criteria of criteria in a generic method that
supports filtering and sorting on all grids in the application.
Thanks for the help, much appreciated.

On Wed, Oct 29, 2008 at 12:52 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote:

> var companyCrit = DetachedCriteria.For<Company>();
> companyCrit .CreateCriteria("Address").Add(Restrictions.Like("City","bru");
>
> companyCrit 
> .CreateCriteria("CompanyGroup","cg").AddOrder(Order.Asc("cg.Name");
>
>
> tada!
>
> On Wed, Oct 29, 2008 at 9:28 AM, Bart Reyserhove <
> [EMAIL PROTECTED]> wrote:
>
>> Yeah I know that is the easy part, what I am trying to do is something
>> along the lines of:
>>
>> DetachedCriteria.For<Company>()
>> .CreateCriteria("Address").Add(Restrictions.Like("City","bru")
>> .CreateCriteria("CompanyGroup","cg").AddOrder(Order.Asc("cg.Name")
>>
>> The problem is of course that CompanyGroup is an association of Company
>> and not of Address.
>>
>>
>> On Wed, Oct 29, 2008 at 4:56 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
>>
>>> Something like:
>>> DetachedCriteria.For<Company>()
>>>   .CreateCriteria("CompanyGroup", "cg")
>>>   .AddOrer(Order.Asc("cg.Name")
>>>
>>>
>>> On Wed, Oct 29, 2008 at 12:21 AM, Bart Reyserhove <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>> I have an domain object: Company.
>>>> 1) Company has an association with an Address
>>>> 2) Company also has an association with CompanyGroup
>>>>
>>>> I am trying to use the ICriteria stuff to create a query that retrieves
>>>> all Companies where Address.Country = 'Belgium' and I want to order this
>>>> result on the name property of CompanyGroup.
>>>>
>>>> The filter is no problem at all. I can easily find all Belgian
>>>> companies, but sorting them on another association seems really difficult 
>>>> at
>>>> first sight.
>>>>
>>>> How can I approach this?
>>>>
>>>> Thanks,
>>>>
>>>> Bart
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to