Lambda Contains in SimpleRepository.Find

Posted by Anton on Stack Overflow See other posts from Stack Overflow or by Anton
Published on 2010-05-20T16:25:25Z Indexed on 2010/05/20 17:10 UTC
Read the original article Hit count: 661

In SubSonic 3.04's SimpleRepository, I cannot seem to perform a Contains operation within a lambda expression. Here's a trivial example:

SimpleRepository repo = new SimpleRepository("ConnectionString");

List<int> userIds = new List<int>();
userIds.Add(1);
userIds.Add(3);

List<User> users = repo.Find<User>(x => userIds.Contains(x.Id)).ToList();

I get the error message:

variable 'x' of type 'User' referenced from scope '', but it is not defined

Am I missing something here, or does SubSonic not support Contains in lambda expressions? If not, how would this be done?

© Stack Overflow or respective owner

Related posts about subsonic

Related posts about simplerepository