0

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.