Hi misterd429,

I could convert int[] ni List<int> without problem. THis way using
.Contains(id) will generate a IN operator ?

Thank you!


On Tue, Jul 17, 2012 at 10:34 AM, mysterd429 <[email protected]>wrote:

> Felipe,
>
> I'd do something like .Where(p => idCategories.Contains(p.IdCategory)),
> but I find it is sometimes finicky about the type.  I use List<int> without
> a problem.
>
>     Don
>
>
> On Monday, July 16, 2012 10:50:09 PM UTC-4, Felipe Oriani wrote:
>
>> Hello Guys, I have a linq query with NHibernate using Session.Query<T>
>> method and I in this query I Fetch some complex properties and collection
>> properties. I would like to know, how cna I add an condition with IN
>> operator from an int[] ? Look my code:
>>
>> public IEnumerable<Product> GetProducts(int[] idCategories)
>> {
>>     // how to add IN condition here or a subquery
>>     var query = Session.Query<Product>().**Where(?????).Fetch(x=>**
>> xCategory).FetchMany(x=>x.**Status).ThenFetch(x=>x.Item);
>>
>>     return query.ToList();
>> }
>>
>> I have another method doing a query to get this int[] and I would like to
>> apply it here, or if is there any way to add this subquery on the IN
>> operator, I really appreciate!
>>
>> Thank you!
>>
>> --
>> ______________________________**________
>> Felipe B. Oriani
>>
>>
>> "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por
>> André Luiz
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/Hqr2JRy-dmYJ.
> 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.
>



-- 
______________________________________
Felipe B. Oriani
felipeoriani.com.br [email protected]
@felipeoriani<http://www.twitter.com/felipeoriani>
 LinkedIn <http://br.linkedin.com/in/felipeoriani>
Facebook<http://www.facebook.com/felipeoriani>
Contato: (19) 9611-8646 / (19) 3421-7850

"...Trabalhe quanto puder, tornando-se útil quanto possível..." , por André
Luiz

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