This isn't really a Fluent question; but you likely need to do

QueryOver<Category>().Where(c => c.ParentCategory == null)

So that you only populate the List with the top-level items; then let each
Parent worry about its own Children.

Carl

On Tue, Jan 24, 2012 at 5:44 PM, Tiago Alves <tiagocr...@gmail.com> wrote:

> Any ideas?
>
>
> 2012/1/17 Tiago Alves <tiagocr...@gmail.com>
>
>> Hi guys,
>>
>> in my database I have the classic model for category/subcategories, using
>> a table like
>> this Category(CategoryID,Name, ParentID)
>>
>> I believe that the mapping is correct since it brings to me all the
>> categories and
>> subcategories, but the problem is that it duplicates the elements.
>> For example:
>>
>> If I have in my table  only:
>>
>> 1 Parent1 Null
>> 2 Son1 1
>>
>> I'm receiving a vector that in a treeView is something like these:
>>
>> Parent1
>>    Son1
>> Son1
>>
>> I tried using AsSet() but it didn't work too.
>>
>> How should I map that? Or maybe I'm querying it wrong. Should I add any
>> restrictions?
>>
>> Thanks
>>
>> --
>> ---------------------------------------------------
>>  Tiago Alves de Oliveira
>>  Engenheiro de Biometria
>>
>> Blog: CodaBR <http://codabr.wordpress.com>
>>
>>  Cel:  (19) 8175-2513
>> -------------------------------------------------------
>>
>>
>
>
> --
> ---------------------------------------------------
>  Tiago Alves de Oliveira
>  Engenheiro de Biometria
>
> Blog: CodaBR <http://codabr.wordpress.com>
>
>  Cel:  (19) 8175-2513
> -------------------------------------------------------
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to