开发者

Linq to nhibernate question

I'm trying to create a query using linq 2 nhibernate which generate a sql like:

select * from table
where id in (1, 2, 3, 4)

At the moment I have this code:

var vouchers = Session.Linq<Voucher>()
                                  .Where(x => campaignIds.Contains(x.Vouch开发者_开发技巧erGroup.Campaign.Id))
                                  .ToArray();

The campaignIds is array of 'long' variables.

But this code will just download all the vouchers and iterate through them to find only those with specific campaignId.

I could of course iterate through the campaign Ids and call the database for each campaign Id and use the union operator but I wonder if there is some more elegant way of doing it.

Thanks


You have found a bug. I use similar queries with the linq provider in the trunk and I don't have problems with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜