Felipe,

I just tested a little bit, and I found that the int[] worked just fine.  
The SQL that was generated was something like WHERE myId in (@p0, @p1, 
@p2), with @p0, @p1, and @p2 being set to whatever was in the array.  The 
number of parameters changes with the size of the array.

Cheers,

    Don

On Tuesday, July 17, 2012 9:52:37 AM UTC-4, Felipe Oriani wrote:
>
> 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 <> 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
> <http://felipeoriani.com.br/>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/nCsWyh5Xqb8J.
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